On November 5, 2002 09:44 pm, Moriyoshi Koizumi wrote: > Ilia, thank you for double-checking. > > Since I have no access to Zend module, I'm waiting for that to be > committed by someone for now... Does it need more review?
It would probably be a good idea if more developers review this patch before it goes in. If there won't be any objections to the patch, I will commit it on your behalf. Ilia > Moriyoshi > > "Ilia A." <[EMAIL PROTECTED]> wrote: > > The new appears to work correctly and previously mentioned problem no > > longer occures. I've also ran the test suit after applying the patch and > > none of the tests have been adversly affected, so it does not appear to > > break any old functionality. > > > > Ilia > > > > On November 5, 2002 09:17 pm, Moriyoshi Koizumi wrote: > > > Perhaps my patch was not sufficient... A revised patch is attached. > > > Please try this one, and if you like the patch, then commit it with > > > extreme care > > > > > > :) > > > > > > Moriyoshi > > > > > > > On November 5, 2002 05:48 pm, Moriyoshi Koizumi wrote: > > > > > The attached patch may be a fix for that bug. > > > > > Hope it works. > > > > > > > > > > Moriyoshi > > > > > > > > > > Moriyoshi Koizumi <[EMAIL PROTECTED]> wrote: > > > > > > I looked into it, and I've found you really got a point. > > > > > > > > > > > > --------------------------- > > > > > > <?php > > > > > > $ragged = array(); > > > > > > $ragged[0] = "a"; > > > > > > $ragged[0][0] = array("1"); > > > > > > var_dump($ragged); > > > > > > ?> > > > > > > --------------------------- > > > > > > > > > > > > The first script causes no leaks, while the second does: > > > > > > --------------------------- > > > > > > <?php > > > > > > $ragged = array(); > > > > > > $ragged[0] = "a"; > > > > > > $ragged[0][0] = (string)array("1"); > > > > > > var_dump($ragged); > > > > > > ?> > > > > > > --------------------------- > > > > > > > > > > > > Thanks for your insight. > > > > > > > > > > > > > > > > > > Moriyoshi > > > > > > > > > > > > "Ilia A." <[EMAIL PROTECTED]> wrote: > > > > > > > I agree with you that this bug may not be critical, I am not > > > > > > > certain why it was marked as such, however I do believe this is > > > > > > > a bug that should be fixed. If my understand of the situation > > > > > > > is correct, the memory leak is the result of original > > > > > > > $ragged[$count] = "$count"; expression. At this point ZE > > > > > > > creates a ZVAL that contains a 2 byte string value, number + > > > > > > > \0. > > > > > > > When $ragged[$count]['idx'] = 'ragged '.$count; is executed, > > > > > > > the original zval containing a string is converted to an array. > > > > > > > During this conversion the string value is not freed and the > > > > > > > result is a memory leak. > > > > > > > > > > > > > > Ilia > > > > > > > > > > > > > > On November 5, 2002 01:45 pm, Moriyoshi Koizumi wrote: > > > > > > > > This appears not a bug, but an expected behaviour for me. > > > > > > > > Let's change it from "Critial" to "Won't Fix" or so on. > > > > > > > > > > > > > > > > ------------------------------------------------------------- > > > > > > > >-- <?php > > > > > > > > $ragged = array(); > > > > > > > > for ($count = 0; $count < 10; $count++) { > > > > > > > > $ragged[$count] = "$count"; > > > > > > > > $ragged[$count]['idx'] = "$count"; > > > > > > > > } > > > > > > > > for ($count = 0; $count < 10; $count++) { > > > > > > > > printf("single %d: %s\n", $count, $ragged[$count]); > > > > > > > > printf("ragged %d: %s\n", $count, > > > > > > > > $ragged[$count]['idx']); } > > > > > > > > ?> > > > > > > > > ------------------------------------------------------------- > > > > > > > >-- > > > > > > > > > > > > > > > > The above snippet is actually a variant of the following > > > > > > > > code: > > > > > > > > ------------------------------------------------------------- > > > > > > > >-- <?php > > > > > > > > $ragged = array(); > > > > > > > > for ($count = 0; $count < 10; $count++) { > > > > > > > > $ragged[$count] = (string)$count; > > > > > > > > $ragged[$count]{(int)'idx'} = (string)$count; > > > > > > > > } > > > > > > > > for ($count = 0; $count < 10; $count++) { > > > > > > > > printf("single %d: %s\n", $count, $ragged[$count]); > > > > > > > > printf("ragged %d: %s\n", $count, > > > > > > > > $ragged[$count]{(int)'idx'}); } > > > > > > > > ?> > > > > > > > > ------------------------------------------------------------- > > > > > > > >-- Then, "Cannot use a scalar value as an array" warnings are > > > > > > > > due to applications of braces for non-string variables. > > > > > > > > But I can't still explain why leaks occured. > > > > > > > > > > > > > > > > Moriyoshi > > > > > > > > > > > > > > -- > > > > > > > PHP Development Mailing List <http://www.php.net/> > > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > > > > > PHP Development Mailing List <http://www.php.net/> > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP Development Mailing List <http://www.php.net/> > > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php