PHP 4.0 Bug #8463 Updated: Using internal function in usort call segfaults

From: Date: Tue, 02 Jan 2001 23:54:18 +0000
Subject: PHP 4.0 Bug #8463 Updated: Using internal function in usort call segfaults
Groups: php.dev 
Request: Send a blank email to php-dev+get-42747@lists.php.net to get a copy of this message
ID: 8463 Updated by: sniper Reported By: greg@darkphoton.com Old-Status: Open Status: Feedback Bug Type: Reproduceable crash Assigned To: Comments: snaps.php.net is up now. --Jani Previous Comments: --------------------------------------------------------------------------- [2001-01-02 13:45:15] greg@darkphoton.com 1. 4.0.4 crashes with either, 4.0.3 works with either 2. snaps.php.net seems to be down and has been for several days --------------------------------------------------------------------------- [2000-12-29 07:04:07] sniper@php.net 1. your test script is buggy, it should be like this: usort( $mblist, "testcmp" ); (notice the "'s) 2. I tried this with the latest CVS and it doesn't crash. Please try the latest snapshot from http://snaps.php.net/ --Jani --------------------------------------------------------------------------- [2000-12-28 13:13:55] greg@darkphoton.com 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(); --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8463

« previous php.dev (#42747) next »