Bug #75580 [Fbk->Opn]: array_column and Traversable objects

From: Date: Mon, 27 Nov 2017 11:51:39 +0000
Subject: Bug #75580 [Fbk->Opn]: array_column and Traversable objects
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212745@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75580&edit=1 ID: 75580 User updated by: thisnicknamewasfree at gmail dot com Reported by: thisnicknamewasfree at gmail dot com Summary: array_column and Traversable objects -Status: Feedback +Status: Open Type: Bug Package: Arrays related Operating System: All PHP Version: 7.1.12 Block user comment: N Private report: N New Comment: <?php $dom = new \DomDocument; $dom->loadHTML('<span>ONE</span><span>TWO</span>'); $xpath = new \DomXPath($dom); # $xpath -> \DOMXPath $nodes = $xpath->query('//span'); # $nodes -> \DOMNodeList # this works: foreach ($nodes as $node) { echo $node->nodeValue; # \DOMElement } # this not: array_column($nodes, 'nodeValue'); ?> Previous Comments: ------------------------------------------------------------------------ [2017-11-27 11:31:40] requinix@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. An array of Traversables? ------------------------------------------------------------------------ [2017-11-27 11:21:22] thisnicknamewasfree at gmail dot com Description: ------------ PHP 7.0+ supports both arrays and array of objects for array_column, However it's not true for array of Traversable objects and looks like a bug. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75580&edit=1

« previous php.bugs (#212745) next »