iliaa           Thu Feb 13 12:25:31 2003 EDT

  Added files:                 
    /php4/ext/standard/tests/strings    bug22207.phpt 

  Modified files:              
    /php4/ext/standard  formatted_print.c 
  Log:
  Fixed bug #22207 (e notation in *printf would be missing a 0 when there is 
  no exponent).
  Added a test case for the bug.
  
  
Index: php4/ext/standard/formatted_print.c
diff -u php4/ext/standard/formatted_print.c:1.63 
php4/ext/standard/formatted_print.c:1.64
--- php4/ext/standard/formatted_print.c:1.63    Sat Jan 11 18:05:19 2003
+++ php4/ext/standard/formatted_print.c Thu Feb 13 12:25:31 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: formatted_print.c,v 1.63 2003/01/11 23:05:19 moriyoshi Exp $ */
+/* $Id: formatted_print.c,v 1.64 2003/02/13 17:25:31 iliaa Exp $ */
 
 #include <math.h>                              /* modf() */
 #include "php.h"
@@ -359,8 +359,12 @@
                numbuf[i++] = fmt;
                exp_p = php_convert_to_decimal(decpt, 0, &dec2, &sign, 0);
                numbuf[i++] = sign ? '-' : '+';
-               while (*exp_p) {
-                       numbuf[i++] = *(exp_p++);
+               if (*exp_p) { 
+                       while (*exp_p) {
+                               numbuf[i++] = *(exp_p++);
+                       }
+               } else {
+                       numbuf[i++] = '0';
                }
        } else {
                numbuf[i++] = cvt[j++];

Index: php4/ext/standard/tests/strings/bug22207.phpt
+++ php4/ext/standard/tests/strings/bug22207.phpt
--TEST--
Bug #22207 (missing 0 when using the e notation in *printf functions)
--FILE--
<?php
        printf("%10.5e\n", 1.1); 
        var_dump(sprintf("%10.5e\n", 1.1));
?>
--EXPECT--
1.1000e+0
string(17) "       1.1000e+0
"



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to