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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Fri Dec 27 01:01:28 2024 UTC