|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-09-15 13:37 UTC] cschneid at cschneid dot com
Description:
------------
Error handler seems to destroy array indices if called due
to a undefined array index generated by a function.
Reproduce code:
---------------
function handler($errno, $errstr, $errfile, $errline)
{
$test = "aaa";
}
set_error_handler('handler');
$output[trim("bbbbbbb")]++;
print_r($output);
Expected result:
----------------
Array
(
[bbbbbbb] => 1
)
Actual result:
--------------
Array
(
[aaa] => 1
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
The problem seems to be that dim->value is overwritten, copying the value solves this. I don't have enough insight in Zend to know if this is a memory leak and the values should be freed at some point or if this is ok. Hope this helps: diff -u -u -r1.316.2.21 zend_execute.c --- Zend/zend_execute.c 30 Jul 2003 16:33:54 -0000 1.316.2.21 +++ Zend/zend_execute.c 15 Oct 2003 12:17:10 -0000 @@ -626,7 +626,7 @@ offset_key_length = 0; goto fetch_string_dim; case IS_STRING: - offset_key = dim->value.str.val; + offset_key = estrndup(dim->value.str.val, dim->value.str.len); offset_key_length = dim->value.str.len; fetch_string_dim: