Edit report at https://bugs.php.net/bug.php?id=55103&edit=1
ID: 55103 Updated by: f...@php.net Reported by: imaggens at gmail dot com Summary: Interfaces avoids Classes to exist -Status: Open +Status: Feedback Type: Bug Package: Class/Object related Operating System: Windows 7 PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: It seems to me your 2 code samples are identical, just one has output attached. Where's the interface? Please provide a *complete* sample, i.e. if your including one file make clear what's in both files, the one having a call to "require" and the one being required Previous Comments: ------------------------------------------------------------------------ [2011-07-01 10:07:08] imaggens at gmail dot com Description: ------------ First at all, one consideration about one of the informations provided in this form is the PHP version. I'm not using 5.3.6. I'm using 5.3.3, which is not listed. I f I chose "earlier", the form won't submit. I can be wrong, but I think this bug is not fixed in newer versions, because it's not a very common use. The whole thing is, when interfaces and classes are in the same namespace AND in same file, the 'implements' breaks the execution of the 'extends'. See Code #1 As expected I can see "Message from Second Class", without quotes. But if I add a interface (see Code #2) I get a Fatal Error: "Class 'Test\Zero' not found", when it could be expected the same result as before. But why this is important, if the best practices are to develop by following an organized structure, with each class/interface in its own file? The thing is, when DEVELOPING, this kind of organization is very useful, but if the code produced during development stage is a little library, if all the classes and interfaces are coded in one single file, only one call to require_once is needed, and the code execution is three times faster than when using an autoloader resource. Note about CodePad's codes: I'd only saved the lines of code in this site, they don't work from it, due PHP versions. But all the tests I made was in machine with the configurations posted. Test script: --------------- [ Code #1 ] http://codepad.org/pDOAiqBa [ Code #2 ] http://codepad.org/a42WgIT3 Expected result: ---------------- As said in Bug's Description, "Message from Second Class", witout quotes. Actual result: -------------- With the first code, I can see the expected result. With the second code, as I said, I see a Fatal Error. If the stack traces helps, here is it: Fatal error: Class 'Test\Test\Zero' not found in C:\root\Test\Library.php on line 5 Call Stack # Time Memory Function Location 1 0.0004 326896 {main}( ) ..\index.php:0 2 0.0018 334024 require_once( 'C:\root\Test\Framework.php' ) ..\index.php:3 Dump $_GET Dump $_POST ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55103&edit=1