|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-05-31 23:12 UTC] dave at codewhore dot org
Hi:
The following script produces different output with PHP 5 HEAD than it does with the PHP 4.3 stable branch:
<?php
$f[1] = 1;
var_dump(array_key_exists('1', $f));
?>
With PHP 4.3 stable, I get:
bool(true)
With PHP 5 HEAD, I get:
bool(false)
It appears that PHP 5 HEAD is missing the call to HANDLE_NUMERIC() in zend_hash_exists (Zend/zend_hash.c). The ZE2 changelog shows that it was moved:
move HANDLE_NUMERIC() from the hash table
implementation upstream to the places that
actually need to use it.
But I'm unable to figure out where the equivalent functionality was added back. Am I missing something?
Thanks in advance,
- Dave
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
Hi Sterling: I think there's a remaining (related) problem, this time with array keys that are strings. I've enclosed a test case. <?php /* This works */ $f = array('7' => 0); var_dump($f); var_dump(array_key_exists(7, $f)); /* This doesn't */ $f = array_flip(array('7')); var_dump($f); var_dump(array_key_exists(7, $f)); ?> On PHP 5, I get: array(1) { [7]=> int(0) } bool(true) array(1) { ["7"]=> int(0) } bool(false) On PHP 4 I get: array(1) { [7]=> int(0) } bool(true) array(1) { [7]=> int(0) } bool(true) Thanks in advance, - Dave