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
"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php