Edit report at https://bugs.php.net/bug.php?id=61736&edit=1
ID: 61736 Updated by: johan...@php.net Reported by: hosiplan at gmail dot com Summary: warning in usort when calling debug_backtrace -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: Linux PHP Version: 5.4.1 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php 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. Previous Comments: ------------------------------------------------------------------------ [2013-01-31 14:17:37] christopher dot loerken at bytro dot com This problem still exists in currentl stable 5.4.11 ------------------------------------------------------------------------ [2012-04-26 13:44:31] 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. http://3v4l.org/1UiAq ------------------------------------------------------------------------ [2012-04-16 08:17:11] hosiplan at gmail dot com Affects version ------------------------------------------------------------------------ [2012-04-15 12:27:13] hosiplan at gmail dot com Description: ------------ 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: --------------- <?php error_reporting(E_ALL | E_STRICT); $versions = array('1', '2'); usort($versions, function ($me, $him) { debug_backtrace(FALSE); 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61736&edit=1