Opened 10 years ago

Closed 8 years ago

Last modified 8 years ago

#234 closed defect (duplicate)

Fatal Error with conditional class definition.

Reported by: tuccen Owned by: moo
Priority: critical Milestone: 1.3.0
Component: cacher Version: 1.2.2
Keywords: Cc:
Application: PHP Version: PHP 5.2.6-3ubuntu4.5
Other Exts: SAPI: Irrelevant
Probability: Blocked By:


With Zend Framework the class definition of the Zend_Exception takes care of the php version and so php < 5.3 triggers an Fatal Error beacause both defnitions are in the same file.
Please have a look at ZF-8984

Change History (6)

comment:1 Changed 10 years ago by weierophinney

To be more general, the issue is with conditional creation of classes. As an example:

if (version_compare(PHP_VERSION, '5.3.0', '<')) {
    class My_Exception extends Exception
        protected $previous;
        public function __construct($message = '', $code = 0, Exception $previous = null)
            $this->previous = $previous;
            parent::__construct($message, $code);
        public function getPrevious()
            return $this->previous;
} else {
    class My_Exception extends Exception {}

In such cases, xcache is attempting to cache two separate class definitions for the same class name, and thus creating an error condition.

In other opcode caches such as APC and Zend Optimizer, only the class definition for the matching condition is cached, which is the appropriate behavior.

comment:2 Changed 10 years ago by moo

  • Status changed from new to accepted

can u pls try 1.3.0?

comment:3 Changed 10 years ago by weierophinney

I can confirm that in 1.3.0, running under either PHP 5.2.12 or 5.3.0, the issue does not present.

I've tried installing an XCache 1.2.2 version against PHP 5.2.12, but cannot get it to compile, unfortunately, so cannot verify the reporter's original issue.

comment:4 Changed 8 years ago by moo

  • Status changed from accepted to new

comment:5 Changed 8 years ago by moo

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #65

comment:6 Changed 8 years ago by moo

  • Milestone changed from 1.3.3 to 1.3.0
Note: See TracTickets for help on using tickets.