|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-08-05 10:12 UTC] md dot xytop at gmail dot com
Description: ------------ After updating our php code (added some classes, have rewritten some functionality) one of our utilites stopped to work. After deep digging we found that php doesn't define a class in some circumstances. In attachment is our handmade example. Try to run file0.php On 5.2.17 and 5.3.2 we have output: /home/vitaly/.../public_html/file3.php /home/vitaly/.../public_html/file4.php /home/vitaly/.../public_html/file2.php /home/vitaly/.../public_html/file1.php /home/vitaly/.../public_html/file0.php On 5.3.5: Fatal error: Class 'Class1' not found in /.../file3.php on line 6 On our real project (which uses 5.2.17) ^^ we have the same fatal error. Project is very big and has many includes, so we can't provide simple example for it, but probably changing example from attachment to one or another side will do the trick.. We don't have 5.3.6 version, yes, we out of date, but I think this is something that's will reoccur from one version to another. Expected result: ---------------- Run file0.php I expect to have loading sequence Actual result: -------------- On some php version I have fatal error that class is undefined. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 02:00:01 2025 UTC |
file0.php: <?php require_once(dirname(__FILE__) . '/file1.php'); class Class0 { } echo __FILE__ . '<br/>' . "\r\n"; ?> file1.php: <?php require_once(dirname(__FILE__) . '/file2.php'); require_once(dirname(__FILE__) . '/file4.php'); class Class1 extends Class0 { } echo __FILE__ . '<br/>' . "\r\n"; ?> file2.php: <?php require_once(dirname(__FILE__) . '/file1.php'); require_once(dirname(__FILE__) . '/file3.php'); require_once(dirname(__FILE__) . '/file4.php'); class Class2 extends Class0 { } echo __FILE__ . '<br/>' . "\r\n"; ?> file3.php: <?php require_once(dirname(__FILE__) . '/file1.php'); class Class3 extends Class1 { } echo __FILE__ . '<br/>' . "\r\n"; ?> file4.php: <?php class Class4 extends Class0 { } echo __FILE__ . '<br/>' . "\r\n"; ?>