#28917 [Opn->Bgs]: Extremly unuseful behavior of $string[index]-feature
| From: | iliaa@php.net | Date: | Fri, 25 Jun 2004 16:16:18 +0000 |
| Subject: | #28917 [Opn->Bgs]: Extremly unuseful behavior of $string[index]-feature | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61374@lists.php.net to get a copy of this message | ||
ID: 28917
Updated by: iliaa@php.net
Reported By: aulbach at ssilk dot de
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: linux
PHP Version: 4.3.7
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Not a bug.
Previous Comments:
------------------------------------------------------------------------
[2004-06-25 12:41:33] aulbach at ssilk dot de
Description:
------------
The following code produces this result:
a2345
This behaviour is not very useful, because this kind of error is
extremly difficult to find.
Reproduce code:
---------------
<?php
$in=array(
'params' => 'action=bla',
'action' => '',
);
$params="12345";
// by error $params is a string
// instead of array or empty
$params['action']=@$in['params'];
// and the following 2000 lines
// of code is able to handle $params either
// as array OR string (e. g.
// cause of backward compatibility to
// further versions of $in)
print_r($params);
?>
Expected result:
----------------
One (or more) of these
* an array (
[0] => 12345
[action] => action=bla
)
* if this result above, a warning message
'String is automagically converted to array, line 8'
* an error message
'A string cannot indiced via string-type, use integer only, line 8'
* a warning message
'Use of [] while indexing a string is depricated, use {}, line 8'
* an error message
'Use of [] while indexing a string is not longer allowed, use {}
instead, line 8'
Actual result:
--------------
a2345
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28917&edit=1