|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-12-12 07:29 UTC] 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 ...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
Sorry for a mistake in code. There should be: // so do this: $a->{18.5*1} = 1; // and this too: $a->{1*1} = 1;