|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-09-05 06:19 UTC] yohgaki@php.net
[2002-09-05 08:05 UTC] fdruseikis at sc dot rr dot com
[2002-09-05 15:04 UTC] kalowsky@php.net
[2002-09-05 15:48 UTC] sniper@php.net
[2002-09-05 16:41 UTC] fdruseikis at sc dot rr dot com
[2002-09-05 16:48 UTC] kalowsky@php.net
[2002-09-06 08:03 UTC] fdruseikis at sc dot rr dot com
[2002-09-06 08:16 UTC] fdruseikis at sc dot rr dot com
[2002-09-06 09:24 UTC] fdruseikis at sc dot rr dot com
[2002-09-06 09:38 UTC] kalowsky@php.net
[2002-09-06 10:23 UTC] fdruseikis at sc dot rr dot com
[2002-09-06 10:50 UTC] fdruseikis at sc dot rr dot com
[2002-09-07 17:39 UTC] kalowsky@php.net
[2002-09-11 06:13 UTC] fdruseikis at sc dot rr dot com
[2002-09-12 17:28 UTC] fdruseikis at sc dot rr dot com
[2002-09-12 22:10 UTC] sniper@php.net
[2002-10-03 17:58 UTC] sas@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 20:00:01 2025 UTC |
The following script demonstrates a problem with restoring session variables that have references to objects. Variables o1 and o2 are supposed to be globals refering to the same object instance. First GET request initializes; POST request changes state. Crash occurs on first POST or second GET. Apache 1.3.26 reports a segmentation fault. Browser (lynx) indicates "Unexpected Network Read Error; ..." If you remove 'o2' from session_register() and initialize the reference to o1 in the POST the crash goes away. Fred Druseikis -------------------- <snip> ----------------------------- <?php # vim: ts=4 filetype=php # segmentation fault on restore of object references class TFoo { var $c; function TFoo($c) { $this->c = $c; } function inc() { $this->c++; } } global $o1, $o2; session_register('o1', 'o2' ); session_start(); if( $_SERVER['REQUEST_METHOD'] == 'GET' ) { echo "GET<br>"; $o1 =& new TFoo(42); $o2 =& $o1; } if( $_SERVER['REQUEST_METHOD'] == 'POST' ) { echo "POST<br>"; } $o1->inc(); $o2->inc(); echo "<tt>o1</tt><br><pre>"; print_r($o1); echo "</pre>"; echo "<tt>o2</tt><br><pre>"; print_r($o2); echo "</pre>"; ?> <html> <head> </head> <body> <form action='/web/a/register/foo.php' method='post' > <input type='text' name='x' value='42' /> <input type='submit' name='submit' value='Submit' /> </form> </body> </html>