ID: 33224 Comment by: m dot hertzog at mhs dot ch Reported By: ypae at hotmail dot com Status: No Feedback Bug Type: Scripting Engine problem Operating System: Windows 2003 Server PHP Version: 5.0.4 New Comment:
It's still there in 5.2.5. Seems not to occour if the includes files are specified with full path i.E. require_once(c:\www\test.com\docs\tobeincluded.php); Previous Comments: ------------------------------------------------------------------------ [2005-08-18 10:39:19] matthius at pointbtel dot com I am experiencing this in v4.4.0 as well. ------------------------------------------------------------------------ [2005-06-10 01:00:04] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-06-02 20:40:40] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-06-02 17:16:47] ypae at hotmail dot com Description: ------------ When I created a lib.inc.php that has a few functions defined (e.g. getmicrocode(), myfunction()) and try to include it on several files with require_once, it somehow included more than once even though the end result of 'path/filename' is identical. My understanding of require_once limitation on Windows (or non-POSIX) platform was that if you have mixed case with the same file name, it will be included again. Another words, as long as you have identical "path/filename" as part of require_once statement, it should include only once. As a result, since you cannot redeclare the same function within the page, you get: Fatal error: Cannot redeclare "functionname()" (previously declared in... Reproduce code: --------------- For example, On lib.inc.php: =============== myfunction1() { echo "hello!";} myfunction2() { echo "hello again!";} On index.php ============ $_my_absolute_path = 'c:/inetpub/wwwroot/'; require_once($_my_absolute_path.'lib.inc.php'); require_once($_my_absolute_path.'template.inc.php'); on template.inc.php =================== $_my_absolute_path = 'c:/inetpub/wwwroot/'; require_once($_my_absolute_path.'lib.inc.php'); // Just in case someone didn't call this previously The realistic code is quite complex: A require_once B and C B require_once C and *D* C require_once *D* and *D* causes redeclare issue when I load A. Expected result: ---------------- the second attempt to include lib.inc.php by using require_once should be ignored because it was already loaded. The same code running on Linux works perfectly and it used to be fine on PHP 4.3.10 But right after I rebuild the server with PHP 5.0.4, I got the following error: Fatal error: Cannot redeclare myfunction1() (previously declared in... Actual result: -------------- the second attempt to include lib.inc.php by using require_once WAS performed and it causes error. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33224&edit=1