Date: 12/28/00
- Next message: Stig Venaas: "Re: [PHP-DEV] array_diff() failures"
- Previous message: Stig Venaas: "Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump"
- In reply to: Stig Venaas: "Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump"
- Next in thread: Stig Venaas: "Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Replying to myself again...
On Sat, Dec 23, 2000 at 09:19:54PM +0100, Stig Venaas wrote:
> On Sat, Dec 23, 2000 at 01:41:07PM +0100, Stig Venaas wrote:
> > On Sat, Dec 23, 2000 at 01:26:07AM +0100, Sascha Schumann wrote:
> > > > 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.
>
> As I thought, other array sorting functions are broken. For instance
> sort() uses qsort with array_data_compare, the result is segfault on
> Solaris. Since array_data_compare isn't a transitive relation, it
I was a bit too quick here, just want to point out that the problem
isn't array_data_compare but the compare function used. The user can
solve this by adding a second argument to set another compare function
than SORT_REGULAR. Still, it's not so good that users are able to get
a segfault.
Stig
-- 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>
- Next message: Stig Venaas: "Re: [PHP-DEV] array_diff() failures"
- Previous message: Stig Venaas: "Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump"
- In reply to: Stig Venaas: "Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump"
- Next in thread: Stig Venaas: "Re: [PHP-DEV] PHP 4.0 Bug #8383: array_unique() causes core dump"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

