|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73847 Recursion when a variable is redefined as array
Submitted: 2016-12-31 07:28 UTC Modified: 2016-12-31 12:16 UTC
From: joyce at ennexa dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 7.1.0 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: joyce at ennexa dot com
New email:
PHP Version: OS:


 [2016-12-31 07:28 UTC] joyce at ennexa dot com
Redefining a variable as an array with the old value as  member causes recursion.

Test script:
$a = 23;
$a = array($a);

Expected result:
    [0] => 23

Actual result:
    [0] => Array


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 12:04 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-12-31 12:04 UTC]
I can't reproduce that: <>.

Please specify the exact version of PHP you're using, which
zend_extensions are enabled, and your OS.
 [2016-12-31 12:16 UTC]
-Status: Feedback +Status: Verified -Assigned To: cmb +Assigned To:
 [2016-12-31 12:16 UTC]
It's an opcache optimizer problem. Wrap it in a function to reproduce:

function test() {
    $a = 23;
    $a = array($a);
 [2016-12-31 12:34 UTC]
Automatic comment on behalf of nikic
Log: Fix bug #73847
 [2016-12-31 12:34 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 00:03:13 2021 UTC