Re: Bug #11432 Updated: crash when restoring references to objects

From: Date: Wed, 20 Jun 2001 14:47:43 +0000
Subject: Re: Bug #11432 Updated: crash when restoring references to objects
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-57392@lists.php.net to get a copy of this message
please try attached patch and report back! tc On Tue, Jun 12, 2001 at 05:40:40PM -0000, sniper@php.net wrote: > ID: 11432 > Updated by: sniper > Reported By: zork@pablosoft.com.pl > Status: Open > Bug Type: Reproducible crash > Operating system: > PHP Version: 4.0.5 > Assigned To: > Comments: > > reproduced with 4.0.6RC3 > > > Previous Comments: > --------------------------------------------------------------------------- > > [2001-06-12 08:29:39] zork@pablosoft.com.pl > Here are two scripts that operates on referenced objects. make.php creates object $b with > reference to object $a as argument. > > After serialize/unserialize show.php checks if the reference still exists. > > PHP 4.0.1pl1 lost references. > PHP 4.0.4pl1 segfaults on show.php > PHP 4.0.5 segfaults on show.php and(!) sometimes on make.php > > Config line: > ./configure --with-pgsql=shared --with-apxs --sysconfdir=/etc --prefix=/usr > --localstatedir =/var --with-config-file-path=/etc/httpd/conf/ > --with-gettext=/usr/share/gettext > > make.php: > <? > class ClassA { > var $arg_a; > }; > > class ClassB { > var $arg_b; > > function ClassB(&$a) { > $this -> arg_b = &$a; > } > }; > > session_start(); > session_destroy(); > session_register("b"); > session_register("a"); > > $a = new ClassA(); > $a -> arg_a = 4; > $b = new ClassB($a); > echo "done. Click <a href="show.php">here</a>"; > ?> > > > show.php: > <? > class ClassA { > var $arg_a; > }; > > class ClassB { > var $arg_b; > > function ClassB(&$a) { > $this -> arg_b = &$a; > } > }; > > session_start(); > $a -> arg_a = 6; > echo $b -> arg_b -> arg_a; > ?> > > --------------------------------------------------------------------------- > > > > ATTENTION! Do NOT reply to this email! > To reply, use the web interface found at > http://bugs.php.net/?id=11432&edit=2 > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

? .session.c.swp Index: session.c =================================================================== RCS file: /repository/php4/ext/session/session.c,v retrieving revision 1.210 diff -u -r1.210 session.c --- session.c 10 Jun 2001 23:26:35 -0000 1.210 +++ session.c 20 Jun 2001 14:47:46 -0000 @@ -405,7 +405,6 @@ PHP_VAR_UNSERIALIZE_INIT(var_hash); - MAKE_STD_ZVAL(current); for (p = q = val; (p < endptr) && (q = memchr(p, PS_DELIMITER, endptr - p)); p = q) { if (p[0] == PS_UNDEF_MARKER) { p++; @@ -418,16 +417,18 @@ name = estrndup(p, namelen); q++; + MAKE_STD_ZVAL(current); if (has_value) { if (php_var_unserialize(&current, &q, endptr, &var_hash)) { + php_set_session_var(name, namelen, current PSLS_CC); - zval_dtor(current); } } PS_ADD_VARL(name, namelen); efree(name); + zval_ptr_dtor(&current); + //FREE_ZVAL(current); } - FREE_ZVAL(current); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return SUCCESS;
« previous php.dev (#57392) next »