PHP 4.0 Bug #8463 Updated: Using internal function in usort call segfaults
| From: | greg at darkphoton dot com | Date: | Tue, 02 Jan 2001 18:45:15 +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-42612@lists.php.net to get a copy of this message | ||
ID: 8463
User Update by: greg@darkphoton.com
Old-Status: Feedback
Status: Open
Bug Type: Reproduceable crash
Description: Using internal function in usort call segfaults
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
Previous Comments:
---------------------------------------------------------------------------
[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