Opened 17 months ago

Closed 17 months ago

Last modified 16 months 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:
Blocking:

Description

Hi

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:

<?php
$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?

Rgds

Change History (2)

comment:1 Changed 17 months 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 16 months ago by moo

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