#47519 [Opn->Bgs]: array key access reports notice
| From: | kalle@php.net | Date: | Fri, 27 Feb 2009 15:50:31 +0000 |
| Subject: | #47519 [Opn->Bgs]: array key access reports notice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134254@lists.php.net to get a copy of this message | ||
ID: 47519
Updated by: kalle@php.net
Reported By: markus dot staab at redaxo dot de
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Vista Business
PHP Version: 5.2.9
New Comment:
Its because your overridding the $params array by assigning a new
value, and since the [] operator also can be used for string offsets
then that notice is produced, not a bug.
Previous Comments:
------------------------------------------------------------------------
[2009-02-27 10:37:13] markus dot staab at redaxo dot de
Description:
------------
access a array key results in a undefined string offset notice.
When swapping lines
$params = $params['params'];
$divider = $params['divider'];
to
$divider = $params['divider'];
$params = $params['params'];
no notice is reported..
PS: Appears in PHP4 and also PHP5.2.8 (5.2.9 not yet tested)
Reproduce code:
---------------
$params = array (
'id' => 1,
'name' => 'Home',
'clang' => 0,
'params' => '',
'divider' => '&',
'extension_point' => 'URL_REWRITE',
'subject' => '',
);
$id = $params['id'];
$name = $params['name'];
$clang = $params['clang'];
$params = $params['params'];
$divider = $params['divider']; // line reports notice
Expected result:
----------------
no notices at all
Actual result:
--------------
Notice: Uninitialized string offset: 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47519&edit=1