Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#305 closed defect (wontfix)

Order of class declaration in same PHP file

Reported by: shumisha Owned by: moo
Priority: major Milestone: black hole
Component: cacher Version: 3.0.0
Keywords: Cc:
Application: PHP Version:
Other Exts: SAPI: Irrelevant
Probability: Always Blocked By:



Some of our customers are having issues running some PHP code on machines running XCache. Don't have exact PHP/XCache versions, as this happens on several machines, but XCache is the common point, and issue appear/Disappear with XCache on/off.

Code is as follow:

$condition = /* some software version condition */
if($condition) {

class myClass extends baseClass {

protected function aMethod($param) {

do something



} else {

class myClass extends baseClass {

protected function aMethod( & $param) {

do something




class baseClass {


/ end of file /

In other words, the baseClass is declared after the top level class extending it.

This is valid PHP code, but with XCache on it fails, PHP throwing a Fatal error: "Class 'baseClass' not found in .....

Can this be fixed please?


Change History (2)

comment:1 Changed 7 years ago by moo

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

The base class should not be declared after being extending. It was supported by old PHP, but deprecated by newer PHP. PHP only support it just to not break some very old code, but it is not supported if some flag is enabled in the Engine. That specified flag is used by XCache. It is impossible for XCache or any other opcode cacher to do the right thing with your code with the limitation of ZendEngine?

comment:2 Changed 7 years ago by moo

  • Milestone changed from undecided to black hole
Note: See TracTickets for help on using tickets.