Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
2622 | major | always | 04-23-08 05:34 | 05-15-08 13:52 | |
|
|||||
Reporter: | perololo | Platform: | |||
Assigned To: | nam | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.1.5 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.2.0 | ||
|
|||||
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) ==================================================================== |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|