From: Ilia Alshanetsky Date: Fri, 22 Dec 2006 04:03:35 +0000 (+0000) Subject: MFB: Fixed bug #39873 (number_format() breaks with locale & decimal points). X-Git-Tag: RELEASE_1_0_0RC1~549 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3eadc2ad5856e7256b5cc156c78fee192889e9a2;p=php MFB: Fixed bug #39873 (number_format() breaks with locale & decimal points). --- diff --git a/ext/standard/math.c b/ext/standard/math.c index f1a6809b48..16b93dac54 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -929,7 +929,11 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho } /* find decimal point, if expected */ - dp = dec ? strchr(tmpbuf, '.') : NULL; + if (dec) { + dp = strpbrk(tmpbuf, ".,"); + } else { + dp = NULL; + } /* calculate the length of the return buffer */ if (dp) { diff --git a/ext/standard/tests/strings/bug39873.phpt b/ext/standard/tests/strings/bug39873.phpt new file mode 100644 index 0000000000..e73f3c8516 --- /dev/null +++ b/ext/standard/tests/strings/bug39873.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #39873 (number_format() breaks with locale & decimal points) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +1,234.56