[PHP-DEV] PHP 4.0 Bug #8463 Updated: Using internal function in usort call segfaults From: sniper <email protected>
Date: 12/29/00

ID: 8463
Updated by: sniper
Reported By: greg <email protected>
Old-Status: Open
Status: Feedback
Bug Type: Reproduceable crash
Assigned To:
Comments:

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

Previous Comments:
---------------------------------------------------------------------------

[2000-12-28 13:13:55] greg <email protected>

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>