Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11586 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63689 invoked by uid 1010); 27 Jul 2004 20:08:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63665 invoked from network); 27 Jul 2004 20:08:50 -0000 Received: from unknown (HELO prp0.prp.physik.tu-darmstadt.de) (130.83.243.130) by pb1.pair.com with SMTP; 27 Jul 2004 20:08:50 -0000 Received: from prp0.prp.physik.tu-darmstadt.de (localhost [127.0.0.1]) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id i6RK8lKf009860; Tue, 27 Jul 2004 22:08:47 +0200 Received: (from swalk@localhost) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/Submit) id i6RK8ls3009859; Tue, 27 Jul 2004 22:08:47 +0200 Date: Tue, 27 Jul 2004 22:08:47 +0200 To: John Coggeshall Cc: internals@lists.php.net Message-ID: <20040727200847.GA9674@prp0.prp.physik.tu-darmstadt.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i Subject: Re: [PHP-DEV] Sorting Bug / Wrong behavior? From: swalk@prp.physik.tu-darmstadt.de (Stefan Walk) On Tue, Jul 27, 2004 at 02:48:28PM -0500, John Coggeshall wrote: > Notice how 0 and c are switched incorrectly. Attached is a patch to > zend_operators.c that fixes it. The Manual says: > Warning > > Be carefull when sorting arrays with mixed types values because sort() > can produce unpredictable results. You could use SORT_STRING, natsort, etc... If this gets "fixed", the $a = "0d9"; var_dump(++$a, ++$a); thing could also be "fixed", as its WTF factor is as high... or "010" == "1e1" being true. It's all the consequence of PHPs handling with numbers and strings, which can produce results that strike you as odd.