ID:               25547
 Updated by:       [EMAIL PROTECTED]
 Reported By:      cschneid at cschneid dot com
 Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      4CVS, 5CVS
 Assigned To:      helly
 New Comment:

You now have a memory leak. I tried something similar too. But we
decided to look for a better solution where we don't gc the variable we
still need.


Previous Comments:
------------------------------------------------------------------------

[2003-10-15 08:19:08] cschneid at cschneid dot com

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:

------------------------------------------------------------------------

[2003-09-15 13:37:55] 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
)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25547&edit=1

Reply via email to