|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-10 00:22 UTC] kalle@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 10 03:00:01 2025 UTC |
Description: ------------ Following script will print '4-FAIL' using php 5.2.9 build and today's snapshot php5.2-200903092130. Following returns true where $k = int(0), which is wrong: if ($k == 'abc') echo "3-FAIL\n"; Also confirmed this is failing on 5.1.6. Reproduce code: --------------- <?php $a = array(4); if ($a[0] != '4') echo "1-FAIL"; if ($a[0] != 4) echo "2-FAIL"; if ($a[0] == 'abc') echo "3-FAIL\n"; foreach ($a as $k => $v) { // $k is ONLY and ALWAYS ZERO (0) var_dump($k); var_dump($v); if ($k == 'abc') echo "4-FAIL\n"; if ($k === 'abc') echo "5-FAIL\n"; if ($v == 'abc') echo "6-FAIL\n"; } Expected result: ---------------- Code should not print anything. Only key is int(0) and only value is int(4)