cvs: php4(PHP_4_3) /ext/standard formatted_print.c /ext/standard/tests/strings bug22207.phpt
| From: | Ilia Alshanetsky | Date: | Thu, 13 Feb 2003 17:26:02 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/standard formatted_print.c /ext/standard/tests/strings bug22207.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-18785@lists.php.net to get a copy of this message | ||
iliaa Thu Feb 13 12:26:02 2003 EDT
Added files: (Branch: PHP_4_3)
/php4/ext/standard/tests/strings bug22207.phpt
Modified files:
/php4/ext/standard formatted_print.c
Log:
MFH
Index: php4/ext/standard/formatted_print.c
diff -u php4/ext/standard/formatted_print.c:1.59.2.1 php4/ext/standard/formatted_print.c:1.59.2.2
--- php4/ext/standard/formatted_print.c:1.59.2.1 Tue Dec 31 11:35:27 2002
+++ php4/ext/standard/formatted_print.c Thu Feb 13 12:26:02 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: formatted_print.c,v 1.59.2.1 2002/12/31 16:35:27 sebastian Exp $ */
+/* $Id: formatted_print.c,v 1.59.2.2 2003/02/13 17:26:02 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
"