ID:               29202
 User updated by:  phreakeehacker at hotmail dot com
 Reported By:      phreakeehacker at hotmail dot com
 Status:           Bogus
 Bug Type:         Session related
 Operating System: Linux Fedora Core 2
 PHP Version:      5.0.0
 New Comment:

Hi Tony,

Thank you for your reply.  I already know that if I move the
session_start I can get it to work.  That's not the problem.  Please
read my post more carefully, since I did take a considerable amount of
time trying to understand why it does what it does.  The moving of the
session_start is not the problem.  It's the fact that it works when the
code is included inline, but when it's included with the "include"
directive it gives me the error.  I'm assuming it's because the inline
code is processed differently than if it is included with the "include"
directive.  Please double check my post.  If the included code is
handled differently than if it were right inline, please direct me to a
place I can read more details about how the code is processed in this
situation.  Otherwise, it makes sense to me that the script should be
compiled exactly the same if the code is inserted via "include" or
right inline.


Previous Comments:
------------------------------------------------------------------------

[2004-12-07 08:50:05] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[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

Reply via email to