From: schapht at drexel dot edu
Operating system: Mac OS 10.3.2
PHP version: 4.3.4
PHP Bug Type: Feature/Change Request
Bug description: include behavior (revisit #11326 and #9673)
Description:
------------
Php 4.3.4 still has this the issue reported in bugs
#11326 and #9673. Even though #11326 lists it as fixed
in (CVS/4.0.7).
Did the behavior change again? Is there a switch
somewhere I'm missing?
If not, would it be possible to add a switch (or another
function) so that includes could be based on the file
calling the include?
Reproduce code:
---------------
//index.php in ./
include_once("./include/A.class.php");
$a = new A();
echo $a->printer();
//A.class.php in ./include
include_once("./B.class.php");
class A {
function printer() {
$b = new B();
return $b->printer();
}
}
//B.class.php in ./include
class B {
function printer() {
return "did it work?";
}
}
Expected result:
----------------
did it work?
Actual result:
--------------
Warning: main(./B.class.php): failed to open stream: No
such file or directory in /Users/schapht/Sites/test/
include/A.class.php on line 3
Warning: main(): Failed opening './B.class.php' for
inclusion (include_path='.:/usr/local/lib/php') in /
Users/schapht/Sites/test/include/A.class.php on line 3
Fatal error: Cannot instantiate non-existent class: b in
/Users/schapht/Sites/test/include/A.class.php on line 7
--
Edit bug report at http://bugs.php.net/?id=27643&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27643&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27643&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27643&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27643&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27643&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27643&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27643&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27643&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27643&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27643&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27643&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27643&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27643&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27643&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27643&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27643&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27643&r=float