ID: 29202 Updated by: [EMAIL PROTECTED] Reported By: phreakeehacker at hotmail dot com -Status: Open +Status: Bogus Bug Type: Session related Operating System: Linux Fedora Core 2 PHP Version: 5.0.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The error message you get is rather clear: you need to ensure that class definition of the object, that is stored in the session, is known *before* the session is started. Move session_start() call after all class definitions and it'll work fine. That's expected behaviour. Previous Comments: ------------------------------------------------------------------------ [2004-10-12 19:52:27] phreakeehacker at hotmail dot com Sorry, the link to the code examples changed to this: http://www.jtoo.net/~bholyoak/nodetest.txt ------------------------------------------------------------------------ [2004-07-16 09:29:50] phreakeehacker at hotmail dot com Description: ------------ I have three classes I'm using in this demo. One class extends a base class, and one class is a container class. If I INCLUDE the base class from a file, it will run the first time, but when I click the submit button I get the error message "Fatal error: container::showNodes() [function.showNodes]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition <b>unknown</b> of the object you are trying to operate on was loaded _before_ the session was started in /var/www/html/nodetest.php on line 20". If I simply include the file 'node.php' literally then it works flawlessly. So it appears to me that somehow the included code is handled differently when it is included via a file than if it were simply pasted literally into the same script in the same exact spot. I've tried all variations of includes (include_once, require, require_once) and nothing seems to make a difference. It also seems to have to do with the session not being able to sort out which class the object is if the object definition is included via the file. Any ideas on this one? Reproduce code: --------------- Two files are needed for this bug, which are located at this URL: http://www.j2.net/~bholyoak/nodetest.txt Expected result: ---------------- I expect it to work the same if the file were included as it works if the code were literally pasted in instead of included. Actual result: -------------- The script runs fine the first time. When I click the submit button, it gives me this error: "Fatal error: container::showNodes() [function.showNodes]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition <b>unknown</b> of the object you are trying to operate on was loaded _before_ the session was started in /var/www/html/nodetest.php on line 20" It DOESN'T give me this error if the code is pasted directly in instead of included. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29202&edit=1