Anonymous | Login | Signup for a new account | 12-17-2024 14:36 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0002622 | [Quercus] | major | always | 04-23-08 05:34 | 05-15-08 13:52 | ||||
Reporter | perololo | View Status | public | ||||||
Assigned To | nam | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.1.5 | ||||||
Summary | 0002622: serialize/unserialize do not handle references | ||||||||
Description |
serialize/deserialize do not handle references at all. - Instead of references, a copy of the referenced entity is stored to the serialised string. - Deserialising a Zend-PHP based string with references failes, too. ==================================================================== See the following example: ==================================================================== <?php header("Content-type: text/plain"); echo "Testing references:\n". "===================\n\n"; $val1 = "original value"; $val2 = array("copied value with a reference inside"); $val2["reference"] =& $val1; $val2["copy"] = $val1; $stack = array(); $stack["ref to val1"] =& $val1; $stack[] = $val2; $val1 = "new value"; $val2Copy =& $stack[1]; $val2Copy["aVal"] = "aVal"; echo "stack content with references is: \n"; var_dump($stack); echo "\nserialized: \n"; echo serialize($stack) . "\n"; // unserialize the same array but created with original Zend PHP 5.0 echo "\nunserializin from original PHP: \n"; $unserializedValue = unserialize('a:3:{s:11:"ref to val1";s:9:"new value";i:0;a:3:{i:0;s:36:"copied value with a reference inside";s:9:"reference";R:2;s:4:"copy";s:14:"original value";}i:1;a:1:{s:4:"aVal";s:4:"aVal";}}'); var_dump($unserializedValue); echo "\n\nQuercus version: " . $_SERVER["SERVER_SOFTWARE"]; ?> ==================================================================== ==================================================================== output with Zend PHP 5.2: ==================================================================== Testing references: =================== stack content with references is: array(3) { ["ref to val1"]=> &string(9) "new value" [0]=> array(3) { [0]=> string(36) "copied value with a reference inside" ["reference"]=> &string(9) "new value" ["copy"]=> string(14) "original value" } [1]=> &array(1) { ["aVal"]=> string(4) "aVal" } } serialized: a:3:{s:11:"ref to val1";s:9:"new value";i:0;a:3:{i:0;s:36:"copied value with a reference inside";s:9:"reference";R:2;s:4:"copy";s:14:"original value";}i:1;a:1:{s:4:"aVal";s:4:"aVal";}} unserializin from original PHP: array(3) { ["ref to val1"]=> &string(9) "new value" [0]=> array(3) { [0]=> string(36) "copied value with a reference inside" ["reference"]=> &string(9) "new value" ["copy"]=> string(14) "original value" } [1]=> array(1) { ["aVal"]=> string(4) "aVal" } } Quercus version: Apache ==================================================================== ==================================================================== output with Quercus 3.1.5: (although I have downloaded quercus-3.1.5.war, quercus reports version 3.1.2) ==================================================================== Testing references: =================== stack content with references is: array(3) { ["ref to val1"]=> &string(9) "new value" [0]=> array(3) { [0]=> string(36) "copied value with a reference inside" ["reference"]=> &string(9) "new value" ["copy"]=> string(14) "original value" } [1]=> &array(1) { ["aVal"]=> string(4) "aVal" } } serialized: a:3:{s:11:"ref to val1";s:9:"new value";i:0;a:3:{i:0;s:36:"copied value with a reference inside";s:9:"reference";s:9:"new value";s:4:"copy";s:14:"original value";}i:1;a:1:{s:4:"aVal";s:4:"aVal";}} unserializin from original PHP: bool(false) Quercus version: Apache PHP Quercus(Open Source 3.1.2) ==================================================================== |
||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed. 27 unique queries executed. |