|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-15 00:09 UTC] tony2001@php.net
[2005-01-23 01:00 UTC] php-bugs at lists dot php dot net
[2008-04-10 05:07 UTC] vinoth at goodluckdomain dot com
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
Description: ------------ If you run the following script with your web browser and reload the page a couple of times, php dumps core. My apache version is 2.0.49 with libphp dynamically linked. Strangely enough, if you change the array index inside the create_function to something bogus, like "d", array_udiff returns an empty array (without issuing an error). The second time the script is called, as usual, php dumps core. With the correct array index, the output is ok the first time. But dumps core the second time is called. Reproduce code: --------------- <? $p1[] = array('a'=>1, 'b'=>'apple'); $p1[] = array('a'=>2, 'b'=>'orange'); $p1[] = array('a'=>3, 'b'=>'banana'); $p2[] = array('a'=>3, 'b'=>'banana'); $p2[] = array('a'=>4, 'b'=>'raspberry'); echo "<pre>"; print_r(array_udiff($p1, $p2,create_function('$a,$b', 'return $a["a"]-$b["a"];'))); echo "</pre>"; ?> Expected result: ---------------- Array ( [0] => Array ( [a] => 1 [b] => apple ) [1] => Array ( [a] => 2 [b] => orange ) ) no matter how many times we run the script Actual result: -------------- The correct result in the first time the script is run, and the following core dump backtrace the second time: #0 0x00000001 in ?? () #1 0x4072bc0a in zend_call_function () from /usr/lib/apache/libphp5.so #2 0x4067dd81 in array_user_compare () from /usr/lib/apache/libphp5.so #3 0x407458c9 in zend_qsort() from /usr/lib/apache/libphp5.so #4 0x40684a19 in php_array_diff () from /usr/lib/apache/libphp5.so #5 0x00000003 in ?? () #6 0x00000004 in ?? () #7 0x4067dcf0 in zif_rsort() from /usr/lib/apache/libphp5.so Previous frame inner to this frame (corrupt stack?)