|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-25 15:50 UTC] iliaa@php.net
[2004-03-26 08:29 UTC] rattray at purdue dot edu
[2004-03-26 11:04 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 15:00:02 2025 UTC |
Description: ------------ using isset() to detect the existence of array subkeys give a false positive. Also, trying to print the content of said non-existing keys gives the first character of the parent key! Reproduce code: --------------- $aArray = array(); $aArray["key"] = "value"; print("<PRE>".print_r($aArray, true)."</PRE>"); if (isset($aArray)) print("Array exists<BR>"); else print("Array does not exist.<BR>"); if (isset($aArray["key"])) print("Array[key] exists, value = '".$aArray["key"]."'<BR>"); else print("Array[key] does not exist.<BR>"); if (isset($aArray["key"]["subkey"])) print("Array[key][subkey] exists, value = '".$aArray["key"]["subkey"]."'<BR>"); else print("Array[key][subkey] does not exist.<BR>"); Expected result: ---------------- Array ( [key] => value ) Array exists Array[key] exists, value = 'value' Array[key][subkey] does not exist Actual result: -------------- Array ( [key] => value ) Array exists Array[key] exists, value = 'value' Array[key][subkey] exists, value = 'v'