|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-12-29 07:04 UTC] sniper@php.net
[2001-01-02 13:45 UTC] greg at darkphoton dot com
[2001-01-02 18:54 UTC] sniper@php.net
[2001-01-03 10:14 UTC] greg at darkphoton dot com
[2001-01-03 10:16 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 05:00:01 2025 UTC |
Using usort() with an internal function segfaults, for example using strcasecmp() in the usort call will fail, but making a function in php called testcmp() which then calls strcasecmp() works fine. This worked in 4.0.3 and below In the following code snipit, the script will print 1 and 2 but crash before 3. $mblist[0] = "Drafts"; $mblist[1] = "LRP"; $mblist[2] = "Sent Items"; $mblist[3] = "INBOX"; $mblist[4] = "Apache"; $mblist[5] = "Internet"; $mblist[6] = "Lists"; $mblist[7] = "People"; $mblist[8] = "Personal"; Function testcmp( $a, $b ) { return strcasecmp( $a, $b ); } echo "1<BR>"; flush(); usort( $mblist, testcmp ); echo "2"; flush(); usort( $mblist, strcasecmp ); echo "3"; flush();