bug #19943
| From: | Moriyoshi Koizumi | Date: | Tue, 05 Nov 2002 18:45:12 +0000 |
| Subject: | bug #19943 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-90522@lists.php.net to get a copy of this message | ||
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