Bug #73847 [Ver->Csd]: Recursion when a variable is redefined as array

From: Date: Sat, 31 Dec 2016 12:34:31 +0000
Subject: Bug #73847 [Ver->Csd]: Recursion when a variable is redefined as array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206263@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73847&edit=1 ID: 73847 Updated by: nikic@php.net Reported by: joyce at ennexa dot com Summary: Recursion when a variable is redefined as array -Status: Verified +Status: Closed Type: Bug Package: Arrays related PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: http://git.php.net/?p=php-src.git;a=commit;h=242d924e599d2c92a5d12873ad1564f7d44f7126 Log: Fix bug #73847 Previous Comments: ------------------------------------------------------------------------ [2016-12-31 12:16:00] nikic@php.net It's an opcache optimizer problem. Wrap it in a function to reproduce: <?php function test() { $a = 23; $a = array($a); print_r($a); } test(); ------------------------------------------------------------------------ [2016-12-31 12:04:18] cmb@php.net I can't reproduce that: <https://3v4l.org/6p5r1>. Please specify the exact version of PHP you're using, which zend_extensions are enabled, and your OS. ------------------------------------------------------------------------ [2016-12-31 07:28:36] joyce at ennexa dot com Description: ------------ Redefining a variable as an array with the old value as member causes recursion. Test script: --------------- <?php $a = 23; $a = array($a); print_r($a); Expected result: ---------------- Array ( [0] => 23 ) Actual result: -------------- Array ( [0] => Array *RECURSION* ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73847&edit=1

« previous php.bugs (#206263) next »