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

From: Date: Fri, 24 Jul 2015 13:05:44 +0000
Subject: Bug #70127 [Opn->Nab]: var_dump((object)array("123" => new stdclass, "123" => "muh"));
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194674@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70127&edit=1 ID: 70127 Updated by: cmb@php.net Reported by: office at moving-byte dot at Summary: var_dump((object)array("123" => new stdclass, "123" => "muh")); -Status: Open +Status: Not a bug Type: Bug -Package: PHP Language Specification +Package: Scripting Engine problem -Operating System: +Operating System: * PHP Version: 5.6.11 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. It is possible to have numeric property names by other means: $o = new StdClass(); $o->{123} = 'foo'; var_dump($o); This is a feature, and not a bug. Previous Comments: ------------------------------------------------------------------------ [2015-07-24 12:40:21] office at moving-byte dot at 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 this bug report at https://bugs.php.net/bug.php?id=70127&edit=1

« previous php.bugs (#194674) next »