From:             phreakeehacker at hotmail dot com
Operating system: Linux Fedora Core 2
PHP version:      5.0.0
PHP Bug Type:     Session related
Bug description:  Weird Session/class problem

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 bug report at http://bugs.php.net/?id=29202&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29202&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29202&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29202&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29202&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29202&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29202&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29202&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29202&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29202&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29202&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29202&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29202&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29202&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29202&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29202&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29202&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29202&r=float

Reply via email to