From: wxjasp02 at smumn dot edu Operating system: Windows Server 2003 PHP version: 4.4.8 PHP Bug Type: Streams related Bug description: require_once is case sensitive
Description: ------------ Require_Once in PHP 4.4.7 appears to be case sensitive in checking files already included. This has triggered 'cannot redeclare class' in situations where a classfile may be already loaded, but require_once doesn't see it. In light testing, I have found that I have to force my code to switch any include or require calls to lower case to avoid this. I realize this is an old version of php, and 4 is officially 'dead'; but I am unaware if this has been fixed. (I wouldn't use 4, however the site where we host refuses to move to PHP5 or update php4 to the latest.) The bug was originally identified in Version 4.3.4, see: Bug# 26552; however I believe it has re-surfaced. System Configuration: Windows Server 2003 Apache 2.0.59 PHP 4.4.7 Reproduce code: --------------- Make a class and put it in a file which you will require_once. <?php class MyClass {} ?> In the file you will run, call: <? require_once('myclass.php'); $obj = new MyClass(); require_once('MyClass.php'); // Will trigger an error // because MyClass cannot be redeclared; however myclass.php // is being loaded TWICE ?> Expected result: ---------------- The expected result is to only load myclass.php ONCE. To confirm the problem, empty the file myclass.php, or put some non-class junk in it. After each require_once, add: print_r(get_included_files()); You should see myclass.php the first time it is called, and myclass.php, MyClass.php, the second. Actual result: -------------- Cannot Redeclare class MyClass in ... on line ... -- Edit bug report at http://bugs.php.net/?id=43821&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43821&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43821&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43821&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43821&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43821&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43821&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43821&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43821&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43821&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43821&r=support Expected behavior: http://bugs.php.net/fix.php?id=43821&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43821&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43821&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43821&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43821&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43821&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43821&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43821&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43821&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43821&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43821&r=mysqlcfg