Re: PHP 4.0 Bug #8383: array_unique() causes core dump
| From: | Sascha Schumann | Date: | Sat, 23 Dec 2000 00:26:07 +0000 |
| Subject: | Re: PHP 4.0 Bug #8383: array_unique() causes core dump | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-42154@lists.php.net to get a copy of this message | ||
On 22 Dec 2000 jr@hyphen.org wrote:
> From: jr@hyphen.org
> 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