Bug #77119 [Opn->Nab]: array_column has changed behaviour for classes
| From: | peehaa@php.net | Date: | Thu, 08 Nov 2018 02:14:29 +0000 |
| Subject: | Bug #77119 [Opn->Nab]: array_column has changed behaviour for classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217855@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77119&edit=1
ID: 77119
Updated by: peehaa@php.net
Reported by: josh at engramdesign dot com dot au
Summary: array_column has changed behaviour for classes
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: Centos
PHP Version: 7.0.32
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
In specific check the documentation of the function you are using including the possible changelog
http://php.net/manual/en/function.array-column.php#refsect1-function.array-column-changelog
Previous Comments:
------------------------------------------------------------------------
[2018-11-08 02:02:20] peehaa@php.net
> This worked fine in previous 7.0.x versions.
3v4l disagrees: https://3v4l.org/Nsjvl
------------------------------------------------------------------------
[2018-11-08 01:47:46] josh at engramdesign dot com dot au
Description:
------------
A recent update to 7.0.32 has caused this bug. Please refer to the reproducible example where an
array of classes is supplied to
array_column.
This worked fine in previous 7.0.x versions.
Test script:
---------------
$class = new \stdClass();
$class->name = 'Test';
var_dump($class);
$names = array_column([$class], 'name');
var_dump($names);
Expected result:
----------------
object(stdClass)#769 (1) { ["name"]=> string(4) "Test" }
array(0) { }
Actual result:
--------------
object(stdClass)#769 (1) { ["name"]=> string(4) "Test" }
array(1) { [0]=> string(4) "Test" }
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77119&edit=1