Bug #70127 [Ana->Dup]: var_dump((object)array("123" => new stdclass, "123" => "muh"));
| From: | cmb@php.net | Date: | Fri, 12 Aug 2016 12:22:05 +0000 |
| Subject: | Bug #70127 [Ana->Dup]: var_dump((object)array("123" => new stdclass, "123" => "muh")); | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203213@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-bytes dot at
Summary: var_dump((object)array("123" => new stdclass, "123"
=> "muh"));
-Status: Analyzed
+Status: Duplicate
Type: Bug
Package: Scripting Engine problem
Operating System: *
PHP Version: 5.6.11
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #66173.
Previous Comments:
------------------------------------------------------------------------
[2015-07-24 15:26:10] bwoebi@php.net
@laruence: note that the overhead will only exist for dynamic property accesses (non-CONST VM
operand and only on a dynamic access - meaning when there is no fast access to property table).
Which should be a rare enough case ⦠and that particular case is already relatively slow.
I think we could afford it?
------------------------------------------------------------------------
[2015-07-24 14:22:34] cmb@php.net
The behavior when casting object to array is already well
documented[1]:
> If an object is converted to an array, the result is an array
> whose elements are the object's properties. The keys are the
> member variable names, with a few notable exceptions: integer
> properties are unaccessible; [...]
[1] <http://php.net/manual/en/language.types.array.php#language.types.array.casting>
------------------------------------------------------------------------
[2015-07-24 14:07:50] laruence@php.net
I don't think so, it will be overhead while casting or accessing for rarely cases..
just with a good document should be fine.
------------------------------------------------------------------------
[2015-07-24 14:07:49] laruence@php.net
I don't think so, it will be overhead while casting or accessing for rarely cases..
just with a good document should be fine.
------------------------------------------------------------------------
[2015-07-24 14:00:47] bwoebi@php.net
IMHO, we really ought to fix that.
arrays store and access (rightfully, I guess) numeric keys as integers.
objects store and access all the keys as strings.
We maybe should do the same numeric access for dynamic properties on objects...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=70127
--
Edit this bug report at https://bugs.php.net/bug.php?id=70127&edit=1