ID:               39488
 Updated by:       [EMAIL PROTECTED]
 Reported By:      michaelw at darkhorse dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: os x
 PHP Version:      5.2.0
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Your data is corrupt.


Previous Comments:
------------------------------------------------------------------------

[2006-11-13 07:08:02] michaelw at darkhorse dot com

Description:
------------
When dealing with an incorrectly formatted serialized array (such as
from a source other than PHP like a javascript, or hand-coded),
unserialize() does not check and convert array keys that are stored as
strings but should be integers.

This makes it impossible to recover the value through any sort of
type-casting.


Reproduce code:
---------------
$badly_serialized_array = 'a:1:{s:1:"0";s:1:"a";}';
$back_to_an_array = unserialize($badly_serialized_array);
echo $back_to_an_array[0];
echo $back_to_an_array['0'];
$v = (string)'0';
echo $back_to_an_array[$v];


Expected result:
----------------
a
a
a

Actual result:
--------------
nothing
nothing
nothing


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39488&edit=1

Reply via email to