#26601 [Opn->WFx]: Property name must be a string
| From: | sniper@php.net | Date: | Mon, 15 Dec 2003 02:13:38 +0000 |
| Subject: | #26601 [Opn->WFx]: Property name must be a string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52054@lists.php.net to get a copy of this message | ||
ID: 26601
Updated by: sniper@php.net
Reported By: tomas dot matousek at matfyz dot cz
-Status: Open
+Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 4.3.4
New Comment:
Fixed in PHP 5, won't fix in PHP 4.
Previous Comments:
------------------------------------------------------------------------
[2003-12-12 07:34:58] tomas dot matousek at matfyz dot cz
Sorry for a mistake in code. There should be:
// so do this:
$a->{18.5*1} = 1;
// and this too:
$a->{1*1} = 1;
------------------------------------------------------------------------
[2003-12-12 07:29:57] tomas dot matousek at matfyz dot cz
Description:
------------
The rules for property names are inconsistent.
See comments in submitted code.
Reproduce code:
---------------
<?
// this is ok
$a->{"x"} = 1;
// fatal error:
$a->{18.5} = 1;
// fatal error:
$a->{1} = 1;
// but this one passes thru:
$a->{true} = 1;
// so do this:
$a->{18.5} = 1;
// and this too:
$a->{1} = 1;
?>
Expected result:
----------------
Either convert floats, integers and booleans to strings automatically
or report fatal error in all cases when property name is not a string
(i.e. if it is object, array, resource, boolean, integer, float,
NULL).
Actual result:
--------------
Fatal error: Property name must be a string ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26601&edit=1