|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61736 warning in usort when calling debug_backtrace
Submitted: 2012-04-15 12:27 UTC Modified: 2013-01-31 14:42 UTC
Avg. Score:3.7 ± 1.4
Reproduced:6 of 6 (100.0%)
Same Version:2 (33.3%)
Same OS:4 (66.7%)
From: hosiplan at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.4.1 OS: Linux
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: hosiplan at gmail dot com
New email:
PHP Version: OS:


 [2012-04-15 12:27 UTC] hosiplan at gmail dot com
When I call a function debug_backtrace() in usort() callback, it triggers 
unrelated warning. 

When i var_dump() it's result, it's OK.

Verified on my mashine
$ php -v
PHP 5.3.11-dev (cli) (built: Mar  1 2012 16:31:39) 

and on my friend's mashine with 5.3.5

Test script:

error_reporting(E_ALL | E_STRICT);

$versions = array('1', '2');

usort($versions, function ($me, $him) {
	return 1;

Expected result:
No warning

Actual result:
Warning: usort() [function.usort]: Array was modified by the user comparison 
function in /home/hosiplan/develop/testing/php/backtrace.error.php on line 18


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-16 08:17 UTC] hosiplan at gmail dot com
Affects version
 [2012-04-16 08:17 UTC] hosiplan at gmail dot com
-PHP Version: 5.3.10 +PHP Version: 5.4.1
 [2012-04-26 13:44 UTC] arjen at react dot com
This worked in 5.3.0, it's broken in 5.3.1-5.3.11 and 5.4.0-5.4.1.
 [2013-01-31 14:17 UTC] christopher dot loerken at bytro dot com
This problem still exists in currentl stable 5.4.11
 [2013-01-31 14:42 UTC]
-Status: Open +Status: Not a bug
 [2013-01-31 14:42 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

User debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); else the array is provided as a part of the retuned array. The engine then can'T guarantee there won't be any changes ... and changes during a sort can lead to unpredictable results.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 29 09:01:25 2020 UTC