ID: 6418 Comment by: info at triin dot net Reported By: nathan at cjhunter dot com Status: Open Bug Type: Feature/Change Request Operating System: Linux 2.0.36 PHP Version: 4.0.1pl2 New Comment:
I had some quite hard time figuring out what is wrong with my code - this defenetly is a bug, not a feature request. I had a lot of PHP files (class in each file) and at the beginning of each one there were the require_once statements to include all the other classes that were used by that class. And suddenly there was a weird collision... Previous Comments: ------------------------------------------------------------------------ [2002-09-09 09:04:35] scallop at iki dot fi Yes, this is a feature that is definately needed in PHP. I am currently working on a project which has very complex class hierarchy (dozens of classes extending each other). Due to complex class hierarchy and the huge amount of code, I am developing classes so that each class is in it's own file. And to make it all simple, I use a small script to combine all this classes into one huge file. It is always possible to create a system that checks class dependencies and creates a combined classfile with classes in proper order. However, I think this is a feature that _should_ be provided by php. (tested on versions 4.2.3, 4.3.0 - still not implemented) I hope I explained my self clear enough. See my report (marked as duplicate): http://bugs.php.net/bug.php?id=19312 ------------------------------------------------------------------------ [2000-08-31 08:48:21] [EMAIL PROTECTED] Yes, you cannot do this in PHP. In fact, you even shouldn't try doing this - why would you need to define class without knowing what it extends? I move it to feature request in the meantime, in case something will explain why this could be useful. ------------------------------------------------------------------------ [2000-08-29 12:20:10] nathan at cjhunter dot com Multiple class extends creates ordering error The below.. <? class c extends b {} class b extends a {} class a {} ?> gives an error 'Fatal error: Class c: Cannot inherit from undefined class b in test.html on line 4', but.. <? class b extends a {} class a {} // class c moved to bottom class c extends b {} ?> works fine. I imagine this could be fixed by first ordering the classes by their given dependencies and then process them one by one. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=6418&edit=1