]> granicus.if.org Git - php/commitdiff
Fixed bug #36392 (wrong number of decimal digits with %e specifier in
authorIlia Alshanetsky <iliaa@php.net>
Fri, 22 Dec 2006 15:29:41 +0000 (15:29 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 22 Dec 2006 15:29:41 +0000 (15:29 +0000)
sprintf).

NEWS
ext/standard/formatted_print.c
ext/standard/tests/strings/bug36392.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index ba989b71aed3985fb0e1e1f55d3d27d53a7fdc5d..9166ab0179acc062ce99c7005b1c51d3222083e3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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 
index 8add3bbddf66d0110cd398c3ec6ecfbaad06bb42..50efb00b1bc1ebed93276fcb21bf1f1e62f9958f 100644 (file)
@@ -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 (file)
index 0000000..8e4cd16
--- /dev/null
@@ -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