Bug #70127 [NEW]: var_dump((object)array("123" => new stdclass, "123" => "muh"));

From: Date: Fri, 24 Jul 2015 12:40:21 +0000
Subject: Bug #70127 [NEW]: var_dump((object)array("123" => new stdclass, "123" => "muh"));
Groups: php.standards 
Request: Send a blank email to standards-+get-840@lists.php.net to get a copy of this message
From:             office at moving-byte dot at
Operating system: 
PHP version:      5.6.11
Package:          PHP Language Specification
Bug Type:         Bug
Bug description:var_dump((object)array("123" => new stdclass, "123" =>
"muh"));

Description:
------------
Usually its not possible to create class and variablenames containing
only numbers.
But if you create an array and typecast it to object, these rules does
not exist anymore. 
 

Test script:
---------------
var_dump((object)array("123" => new stdclass, "123" => "muh"));


Expected result:
----------------
PHP Parse error:  syntax error, unexpected '123' (T_LNUMBER), expecting
identifier (T_STRING) 

Actual result:
--------------
object(stdClass)#1 (1) {
  [123]=>
  string(3) "foo"
}


-- 
Edit bug report at https://bugs.php.net/bug.php?id=70127&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70127&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70127&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70127&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70127&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70127&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70127&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70127&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70127&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70127&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70127&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70127&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70127&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70127&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70127&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70127&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70127&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70127&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70127&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70127&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70127&r=mysqlcfg



Thread (1 message)

  • office at moving-byte dot at
« previous php.standards (#840) next »