|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-22 11:03 UTC] alberty at neptunelabs dot de
hi,
the declaration of a second dimension in a normal array results
a strange array content.
<?php
$x['c']='foo';
$x['c']['d']='bar';
print_r($x);
?>
results:
Array
(
[c] => boo
)
is this a normal behavior?
i think this ist completely wrong, because 'd' is not string position 1.
Also a normal condition like
<?php
$x['c']='foo';
if (isset($x['c']['y'])) echo 'yep';
else echo 'no';
?>
results true ... but it is absolutely not true
i have test it on linux with the lastest cvs tree php version.
regards,
Steve
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 00:00:01 2025 UTC |
Hello, i've noticed this error to and i think it is very critical. I think the error has to do with strings that are checked as if they were arrays. example: $string = 'wef23'; if(isset($string['key'])) { echo 'true'; } else { echo 'false'; } it always returns true. Tested with: - PHP Version 4.1.1 (Linux infong 2.2.20-hap-2 #1 Fri Dec 14 17:08:09 CET 2001 m68k recovery) [Suse Linux] - PHP Version 4.0.6 (OpenBSD i386.ports.openbsd.org 3.0 GENERIC#2 i386) - PHP Version 4.1.0 (Windows NT 5.1 build 2600) [Windows XP] You can get around this bug if you add an extra check: if(is_array($string) && isset($string['key'])) but i think this could easily be done in the php c souces, or not? bye Lutz Warnke