php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26601 Property name must be a string
Submitted: 2003-12-12 07:29 UTC Modified: 2003-12-14 21:13 UTC
From: tomas dot matousek at matfyz dot cz Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.3.4 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tomas dot matousek at matfyz dot cz
New email:
PHP Version: OS:

 

 [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 ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-12 07:34 UTC] 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-14 21:13 UTC] sniper@php.net
Fixed in PHP 5, won't fix in PHP 4.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 01:01:31 2024 UTC