From: [EMAIL PROTECTED]
Operating system: Apache
PHP version: 4.2.1
PHP Bug Type: Session related
Bug description: Complex objects not correctly stored in ssession
Complex objects are not correctly stored in a session. This report is
similar to 8676, which was reported fixed. It now appears to be broken in
4.2.1.
Here is a code scriplet to demonstrate the problem:
<?
class Alpha
{
var $alpha1;
var $betavar;
function Alpha()
{
$this->betavar =& new Beta(&$this); //Let Beta use Alpha's methods
and
properties
$this->alpha1 = 22;
}
function getvar()
{
return $this->alpha1;
}
}
class Beta
{
var $beta1;
var $alphacall;
function Beta(&$par)
{
$this->alphacall = &$par; //alphacall will let Beta use
Alpha's methods
and properties
$this->beta1 = 5;
}
function getalphavar()
{
print("<br>The value of the alphavar from within Beta is: " .
$this->alphacall->alpha1 );
}
}
session_start();
if (! session_is_registered("pm") )
{
session_register("pm"); // register and instantiate the variable
$pm =& new Alpha();
}
print("<br>The vaue of alpha1 is: " . $pm->getvar() );
print("<br>The value of beta1 is: " . $pm->betavar->beta1);
print("<br>" . $pm->betavar->getalphavar() );
?>
OBSERVED BEHAVIOR:
When this page is loaded the first time, everything works as expected, and
the
values of alpha1, and beta 1 print out just fine. However, attempts
to refresh the page yield a browser error message "This page cannot be
displayed".
This structure worked (flakily) on 4.04pi1, and I was hoping that the fix
of 8676 would
have made it solid in 4.2.1. However, the situation is now worse--the
above structure
NEVER works.
--
Edit bug report at http://bugs.php.net/?id=17419&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17419&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17419&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17419&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17419&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17419&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17419&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17419&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17419&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17419&r=globals