|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-28 13:25 UTC] bjori@php.net
[2006-04-28 18:13 UTC] paul at stunning-stuff dot com
[2006-04-28 18:58 UTC] bjori@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Apr 01 10:00:02 2026 UTC |
Description: ------------ I have seen 2 reports (#30452 & #30453) that seem similar to this bug. Both of them were closed with the message 'Won't fix'. I don't think this is fair, it is a bug and it should be fixed because it seriously limits the OOP capabilities of PHP5. I included a feasible real-world example that shows why this bug should be fixed (I tried to make it as short as possible). Running index.php will cause a Fatal Error because Manager could not be found in language_manager.class.php on line 6. This happens because Manager is declared after LanguageManager is declared, even though (visually) manager.class.php is included before language_manager.class.php. The strange thing is, when Manager doesn't implement the interface Whatever, everything is fine! If it works without an interface it should work with an interface as well. Thanks for the time and effort you guys spend on making a great programming language. I know it's free, so I am not going to demand a fix :-), I'll just say 'pretty please' instead ;-). Thanks, Paul Reproduce code: --------------- index.php <?php // We require this file because we plan to use a manager object in here. require_once 'manager.class.php'; ?> manager.class.php <?php // Manager implements Whatever. require_once 'whatever.class.php'; // Manager uses LanguageManager to translate errors. require_once 'language_manager.class.php'; class Manager implements Whatever { public function functionCausingError() { // LanguageManager is used to translate an error caused in this function. $languageManager = new LanguageManager(); } } ?> language_manager.class.php <?php // LanguageManager extends Manager. require_once 'manager.class.php'; class LanguageManager extends Manager { } ?> whatever.class.php <?php interface Whatever { } ?> Expected result: ---------------- No output Actual result: -------------- Fatal error: Class 'Manager' not found in C:\Web Server\Web Root\sandbox\bug\language_manager.class.php on line 6