php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72002 incorrect debug_backtrace() args
Submitted: 2016-04-11 15:39 UTC Modified: 2016-04-11 23:33 UTC
From: flip101 at gmail dot com Assigned:
Status: Wont fix Package: Testing related
PHP Version: 7.0.5 OS: Windows 10 64bits
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: flip101 at gmail dot com
New email:
PHP Version: OS:

 

 [2016-04-11 15:39 UTC] flip101 at gmail dot com
Description:
------------
On PHP 7.0.4 the args in debug_backtrace() do not give the correct arguments at the time of the call.

Test script:
---------------
<?php
function foo($var) {
  array_shift($var);
  var_dump(debug_backtrace());
}
$bar = ['a'];
foo($bar);

Expected result:
----------------
array(1) {
  [0]=>
  array(4) {
    ["file"]=>
    string(11) "test.php"
    ["line"]=>
    int(8)
    ["function"]=>
    string(3) "foo"
    ["args"]=>
    array(1) {
      [0]=>
      array(0) {
        [0]=>
        string(1) "a"
      }
    }
  }
}

Actual result:
--------------
array(1) {
  [0]=>
  array(4) {
    ["file"]=>
    string(11) "C:\test.php"
    ["line"]=>
    int(8)
    ["function"]=>
    string(3) "foo"
    ["args"]=>
    array(1) {
      [0]=>
      &array(0) {
      }
    }
  }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-11 23:33 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2016-04-11 23:33 UTC] nikic@php.net
PHP 7 does not retain original arguments for performance reasons. This is intentional and will not be fixed.
 [2016-04-12 07:02 UTC] flip101 at gmail dot com
Performance is not relevant when debugging. Would be nice to have the option available to set php in such a way that debug_backtrace() gives the expected result.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 09:01:29 2024 UTC