#49264 [Opn->Bgs]: Can use any scalar as an array
ID: 49264
Updated by: jani@php.net
Reported By: a dot dotreppe at aspyct dot org
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows Vista 32bit
PHP Version: 5.3.0
New Comment:
Thank you for not searching before submitting another report about same
issue. This is also documented already. See also bug #41195
Previous Comments:
------------------------------------------------------------------------
[2009-08-14 22:32:03] a dot dotreppe at aspyct dot org
Description:
------------
Hi
I just noticed that any scalar type could be used as an array.
This could be source of a long list of undetectable bugs.
Should this be considered as a bug ?
Except for strings, that should be indexable. But then, only with
numeric indexes, not strings (that are anyway evaluated to 0).
Reproduce code:
---------------
$value = false;
var_dump($value['hello']);
$value = 4;
var_dump($value['hello']);
$value = 74.6;
var_dump($value['hello']);
$value = 'hello';
var_dump($value['hello']);
Expected result:
----------------
Some Fatal error, something brutal that will halt the script.
Actual result:
--------------
NULL NULL NULL string(1) "h"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49264&edit=1
Thread (4 messages)