Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump From: Sascha Schumann (sascha <email protected>)
Date: 12/22/00

On 22 Dec 2000 jr <email protected> wrote:

> From: jr <email protected>
> Operating system: Solaris 2.7
> PHP version: 4.0.3pl1
> PHP Bug Type: Reproduceable crash
> Bug description: array_unique() causes core dump
>
> array_unique() can cause php to core dump. i haven't quite figured out the exact situation though.
>
> this works:
>
> array_unique(array("socket", "37", "99", "3d"));
>
> this does not:
>
> array_unique(array("socket", "370", "99", "3d"));

    With the above input, qsort sees this:

    "socket" > "3d" (due to string comparison)
    ^ "3d" > "370" (string)
    ^ "370" > "99" (int)
    ^ "99" > "3d" (string)

    That violates the rule "a > b ^ b > c => a > c". Solaris'
    qsort does not like that and causes a segfault.

    One way to address this issue is to stick to one particular
    comparison function. Stig, what do you think?

    - Sascha

-- 
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>