Edit report at http://bugs.php.net/bug.php?id=47643&edit=1
ID: 47643 Comment by: lonnyk at gmail dot com Reported by: viper7 at viper-7 dot com Summary: array_diff() takes over 3000 times longer than php 5.2.4 Status: Assigned Type: Bug Package: Performance problem Operating System: * PHP Version: 5.*, 6CVS (2009-04-13) Assigned To: felipe Block user comment: N New Comment: I feel as though the actual bug here is the fix that caused this issue. If you revert the fix and typecast the variables passed into the custom compare function as (string) then this works fine. This is in line with other non-user defined comparison functions, they compare as === and not == Previous Comments: ------------------------------------------------------------------------ [2010-04-16 22:20:37] sylvain at jamendo dot com I would also appreciate a patch, this issue made our servers crash after a php 5.3 upgrade :-/ thanks! ------------------------------------------------------------------------ [2010-02-17 20:53:53] maarten at talkin dot nl Why dont you only reset ptr if (behavior & DIFF_ASSOC) ? ------------------------------------------------------------------------ [2010-01-17 12:09:15] emiel dot bruijntjes at copernica dot com This bug is now open for 10 months. Are you still working on this? ------------------------------------------------------------------------ [2009-07-09 20:38:20] j...@php.net As Dmitry's noted, this is side-effect your fix caused. ------------------------------------------------------------------------ [2009-07-01 15:32:01] dmi...@php.net The problems occurs because of "bad" patch for bug #42838. The diff algorithm sorts arrays using qsort and then assumes that they are sorted correctly. But in case of user compaison function it can't be guaranteed. Thus in ext/standard/tests/array/bug42838.phpt key_compare_func() can't sort array correctly because expressions (0 < 'a') and (0 > 'a') both false ('a' is interpreted as a number 0). It should be fixed in some way ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=47643 -- Edit this bug report at http://bugs.php.net/bug.php?id=47643&edit=1