Req #71208 [Dup]: Array/Object cast should not loose numeric property/element accessibility

From: Date: Sat, 24 Sep 2016 01:12:46 +0000
Subject: Req #71208 [Dup]: Array/Object cast should not loose numeric property/element accessibility
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204226@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71208&edit=1

 ID:                 71208
 Updated by:         ajf@php.net
 Reported by:        ajf@php.net
 Summary:            Array/Object cast should not loose numeric
                     property/element accessibility
 Status:             Duplicate
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   OS X 10.11 El Capitan
 PHP Version:        7.0.1
 Assigned To:        ajf
 Block user comment: N
 Private report:     N

 New Comment:

It's not a duplicate of bug #66173, it's a deliberate counterpart to it.


Previous Comments:
------------------------------------------------------------------------
[2016-08-12 12:24:50] cmb@php.net

Well, actually this is a duplicate of bug #66173.

------------------------------------------------------------------------
[2016-08-08 12:17:56] cmb@php.net

For the record: this issue had already been reported as bug
#53838, which had been suspended, and as bug #61655, which has
been marked as not-a-bug, because of performance issues.

So that's probably something that would have to be discussed on
internals, if that hadn't already happened.

> This has been broken since at least PHP 5.4.

It behaves this way as of PHP 5.0.0, and didn't work earlier at
all, see <https://3v4l.org/55kiC>.

------------------------------------------------------------------------
[2016-08-08 12:13:14] cmb@php.net

Related To: Bug #70835

------------------------------------------------------------------------
[2015-12-24 01:01:42] ajf@php.net

Er, the test script has an off-by-one error. It should be:

<?php

$arr = [1, 2, 4];
$obj = (object)$arr;

var_dump($obj);
var_dump($obj->{0}, $obj->{1}, $obj->{2});
var_dump($obj->{'0'}, $obj->{'1'}, $obj->{'2'});

?>

------------------------------------------------------------------------
[2015-12-23 23:52:02] ajf@php.net

This has been broken since at least PHP 5.4.

------------------------------------------------------------------------


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=71208


--
Edit this bug report at https://bugs.php.net/bug.php?id=71208&edit=1


Thread (7 messages)

« previous php.bugs (#204226) next »