|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-13 08:15 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 10:00:01 2025 UTC |
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