Hi there,
I didn't know whether to make an official bug report or send to the list --
so I'm trying this first. :-)
var_dump(array_count_values(array(' 001', 1, ' 1 ', '1')));
Expected result (and what PHP 4 gives):
array(3) {
[" 001"]=>
int(1)
[1]=>
int(2)
[" 1 "]=>
int(1)
}
Actual result:
array(2) {
[1]=>
int(3)
[" 1 "]=>
int(1)
}
Can this patch please be applied for 5.2's release? To maintain what I'm
sure is the correct behavior from PHP 4, the function needs to use the
zend_[u_]symtable* functions, which take care of *correctly* handling
numeric strings, as zend_hash_[find|update] did in 4.x. If they would've
been used in 5+ in the first place, there wouldn't have been bugs like
#34723 (still present with leading whitespace, as you can see), #30833,
#29808, etc. (I guess that's all, actually). :-)
The updated code should be faster, too...
http://realplain.com/php/array_count_values_bug.diff
http://realplain.com/php/array_count_values_bug_5_2.diff
Thanks,
Matt
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php