diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/standard/formatted_print.c | 3 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug36392.phpt | 16 |
3 files changed, 18 insertions, 4 deletions
@@ -16,7 +16,6 @@ PHP NEWS __inet_pton() and inet_ntop() was named __inet_ntop(). (Hannes) - Fixed the validate email filter so that the letter "v" can also be used in the user part of the email address. (Derick) - - Fixed bug #39903 (Notice message when executing __halt_compiler() more than once). (Tony) - Fixed bug #39898 (FILTER_VALIDATE_URL validates \r\n\t etc). (Ilia) @@ -31,6 +30,8 @@ PHP NEWS - Fixed bug #39815 (SOAP double encoding is not locale-independent). (Dmitry) - Fixed bug #39685 (iconv() - undefined function). (Hannes) - Fixed bug #38852 (XML-RPC Breaks iconv). (Hannes) +- Fixed bug #36392 (wrong number of decimal digits with %e specifier in + sprintf). (Matt,Ilia) 14 Dec 2006, PHP 5.2.1RC1 - Added a meta tag to phpinfo() output to prevent search engines from indexing diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 8add3bbddf..50efb00b1b 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -229,9 +229,6 @@ php_sprintf_appenddouble(char **buffer, int *pos, switch (fmt) { case 'e': - if (precision) { - precision--; - } case 'E': case 'f': case 'F': diff --git a/ext/standard/tests/strings/bug36392.phpt b/ext/standard/tests/strings/bug36392.phpt new file mode 100644 index 0000000000..8e4cd16c67 --- /dev/null +++ b/ext/standard/tests/strings/bug36392.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #36392 (wrong number of decimal digits with %e specifier in sprintf) +--FILE-- +<?php + echo sprintf("%e\n", 1.123456789); + echo sprintf("%.10e\n", 1.123456789); + echo sprintf("%.0e\n", 1.123456789); + echo sprintf("%.1e\n", 1.123456789); + echo sprintf("%5.1e\n", 1.123456789); +?> +--EXPECT-- +1.123457e+0 +1.1234567890e+0 +1e+0 +1.1e+0 +1.1e+0 |