RE: [PHP-DEV] PHP 4.0 Bug #8224 Updated: serialize() fails on arrays of objects
| From: | James Moore | Date: | Thu, 14 Dec 2000 00:35:23 +0000 |
| Subject: | RE: [PHP-DEV] PHP 4.0 Bug #8224 Updated: serialize() fails on arrays of objects | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41274@lists.php.net to get a copy of this message | ||
Hmm Ill have to remeber to use Bogus in the future.. second time ive done
this :)
James
> -----Original Message-----
> From: waldschrott@php.net [mailto:waldschrott@php.net]
> Sent: 14 December 2000 00:28
> To: php-dev@lists.php.net
> Subject: [PHP-DEV] PHP 4.0 Bug #8224 Updated: serialize() fails on
> arrays of objects
>
>
> ID: 8224
> Updated by: waldschrott
> Reported By: stefan.andreatta@uibk.ac.at
> Old-Status: Closed
> Status: Bogus
> Bug Type: Variables related
> Assigned To:
> Comments:
>
> bogus, it is an error the user script
>
> Previous Comments:
> ------------------------------------------------------------------
> ---------
>
> [2000-12-13 08:21:57] jmoore@php.net
> The serialize bugs have been fixed in CVS. Please upgrade to
> 4.0.4 when it is avaible (you can get last RC *very stable* from
> ftp.phpuk.org)
>
> James
>
> ------------------------------------------------------------------
> ---------
>
> [2000-12-13 07:08:19] stefan.andreatta@uibk.ac.at
> If an array of objects is serialized/unserialized the array
> looses those elements (objects) for which a method has been
> called before serialization.
>
> This bug occurs in version 4.0.3pl1, but disappears when the
> php4ts.dll is exchanged for version 4.0.2 (no other changes to
> the installation required).
>
> This bug could be linked to #7619. Unfortunately I can't compile
> a Windows .dll at the moment, so I can't check with the CVS.
>
> The following samples script defines a simple class with one
> property and one method. Then an array is created containing two
> instances of this class. After calling the object's method for
> element[1] the array is serialized/unserialized. After that it
> contains only 1 element.
>
> -- script ----------------------------------------------
>
> <?php
>
> class TestClass
> {
> function TestClass ($a)
> {
> $this->property = $a;
> }
> function getProperty ()
> {
> return $this->property;
> }
> }
>
> //create instance
> $testArr[] = new TestClass("content 1");
> $testArr[] = new TestClass("content 2");
>
> $testArr[1]->getProperty();
> $unser = unserialize(serialize($testInst));
>
> echo "Before Serialization:";
> echo "<br>number of elements: " . count($testArr);
> echo "<br>property of element[0]: " . $testArr[0]->property;
> echo "<br>property of element[1]: " . $testArr[1]->property;
>
> echo "<br><br>After Serialization:";
> echo "<br>number of elements: " . count($unser);
> echo "<br>property of element[0]: " . $unser[0]->property;
> echo "<br>property of element[1]: " . $unser[1]->property;
>
> ?>
>
> -- end of script ----------------------------------------
>
> ------------------------------------------------------------------
> ---------
>
>
> Full Bug description available at: http://bugs.php.net/?id=8224
>
>
> --
> 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