From: Rasmus Lerdorf Date: Tue, 21 Jul 2009 21:15:48 +0000 (+0000) Subject: Fix bug #49003 by tweaking the fix to bug #44929 slightly. X-Git-Tag: php-5.2.11RC1~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=954bb8e35e2172614f59320d106f75220987b137;p=php Fix bug #49003 by tweaking the fix to bug #44929 slightly. A 0 followed by any punctuation is now significant instead of just 0's in front of a period. --- diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c index 366c12449f..c3a8a82010 100644 --- a/ext/standard/strnatcmp.c +++ b/ext/standard/strnatcmp.c @@ -116,10 +116,10 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len ca = *ap; cb = *bp; /* skip over leading spaces or zeros */ - while (isspace((int)(unsigned char)ca) || (ca == '0' && (ap+1 < aend) && (*(ap+1)!='.'))) + while (isspace((int)(unsigned char)ca) || (ca == '0' && (ap+1 < aend) && !ispunct(*(ap+1)))) ca = *++ap; - while (isspace((int)(unsigned char)cb) || (cb == '0' && (bp+1 < bend) && (*(bp+1)!='.'))) + while (isspace((int)(unsigned char)cb) || (cb == '0' && (bp+1 < bend) && !ispunct(*(bp+1)))) cb = *++bp; /* process run of digits */ diff --git a/ext/standard/tests/array/bug44929.phpt b/ext/standard/tests/array/bug44929.phpt index dd2b0db077..efcbcda1cc 100644 --- a/ext/standard/tests/array/bug44929.phpt +++ b/ext/standard/tests/array/bug44929.phpt @@ -2,20 +2,24 @@ Bug #44929 (natsort doesn't handle leading zeros well) --FILE-- --EXPECT-- -array(10) { +array(12) { [6]=> string(4) "-123" [8]=> string(2) "00" [9]=> string(1) "0" + [11]=> + string(3) "0-0" [7]=> string(5) "0.002" + [10]=> + string(3) "0_0" [0]=> string(3) "001" [4]=>