1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Server Issue Can't register without outcommenting a ZEND file

Discussion in 'Resolved Bug Reports' started by Marcus, Oct 8, 2012.

  1. Marcus

    Marcus Well-Known Member

    When I click on the login/register of my forum there is an error if I click on register and have a username already filled in. If I let this field empty, then I can access the register page. However then I also can't complete registration as the page /register/register gives me a " Fatal error: require(): Cannot redeclare class zend_loader in /var/www/vhosts/domain.com/httpdocs/library/Zend/Validate.php on line 201 " error. Same error is for /login/login

    After outcommenting the 201th require_once line in library/Zend/Validate.php it works!
    Code:
        public static function is($value, $classBaseName, array $args = array(), $namespaces = array())
        {
            $namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, array('Zend_Validate'));
            $className  = ucfirst($classBaseName);
            try {
                if (!class_exists($className, false)) {
                    //           require_once 'Zend/Loader.php';
                    foreach($namespaces as $namespace) {
                        $class = $namespace . '_' . $className;
                        $file  = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
                        if (Zend_Loader::isReadable($file)) {
                            Zend_Loader::loadClass($class);
                            $className = $class;
                            break;
                        }
                    }
                }
     
  2. Insy

    Insy Well-Known Member

    The Zend_Loader should not be used and this condition (!class_exists($className, false)) should never be true as XenForo provides its own autoloader. The problem must be elsewhere.
    Make sure there is no missing file in library/.
     
    Marcus likes this.
  3. Marcus

    Marcus Well-Known Member

    I have reuploaded all origina xenforo files. The problem is still there, until I outcomment the line in Validate.php.
     
  4. Insy

    Insy Well-Known Member

    Could you add below try { this line:
    PHP:
    echo $className;
    It will show which class is missing.
     
    Jake Bunce and Marcus like this.
  5. Marcus

    Marcus Well-Known Member

    I get this message:

    Code:
     EmailAddressEmailAddress 
     
    Jake Bunce likes this.
  6. Insy

    Insy Well-Known Member

    Thanks. Do you have this file: library/Zend/Validate/EmailAddress.php ?
     
  7. Marcus

    Marcus Well-Known Member

    Yes, I have the file library/Zend/Validate/EmailAddress.php
     
  8. Insy

    Insy Well-Known Member

    Hum, this is really weird. Have you tried without addons ?
     
  9. Marcus

    Marcus Well-Known Member

    I have deactivated all products in ACP now and the problem is still there. I also deactivated products with the config.php line before.
     
  10. Insy

    Insy Well-Known Member

    At the moment, I do not know where this bug could come in XenForo if it's not a corrupt cache or a file issue :(
     
    Jake Bunce likes this.
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Umm, that shouldn't be double. For example, the user datawriter in XenForo calls that function:

    Code:
    		if (Zend_Validate::is($username, 'EmailAddress'))
    		{
    			$this->error(new XenForo_Phrase('please_enter_name_that_does_not_resemble_an_email_address'), 'username');
    			return false;
    		}
    
    Just one 'EmailAddress'. So unless there is an addon or file modification changing the string literal then I am inclined to blame the APC cache or possibly ionCube like I said in the ticket. Basically we are looking at 'excess' PHP extensions as possible troublemakers.
     
    Insy likes this.
  12. Marcus

    Marcus Well-Known Member

    Without IonCube it is not working. And I already disabled APC cache for Xenforo before. I will make a clean xenforo install and within a new database on the server and try it with that.
     
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I tried that too. But note that you are using two different caches. APC can function as both a memory cache and an opcode cache. You are using both. The opcode cache is suspect in this case.

    I only tried disabling the memory cache by commenting the cache configuration in your library/config.php file. The opcode cache is more transparent and doesn't involve any special configuration in XenForo. You would have to remove the APC extension from PHP to disable the opcode cache.
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Err... nevermind. This doesn't necessarily indicate a problem. That function can be called multiple times resulting in multiple echos. The user datawriter has 3 possible calls to that function.
     
    MichaelDance and Marcus like this.
  15. Mike

    Mike XenForo Developer Staff Member

    I suspect this is likely caused by an include_path being set via a php_admin_value in a vhost/httpd.conf file to a location that includes ZF but not our version of ZF. Unfortunately, it's basically impossible for us to work around that.
     
    Slavik likes this.

Share This Page