PHP 4 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+?? Jan 2004, Version 4.3.5
+- Fixed bug #26878 (problem with multiple references to the same variable
+ with different types). (Ilia)
+- Fixed bug #26896 (ext/ftp does not work as shared extension). (Jani)
+
12 Jan 2004, Version 4.3.5RC1
- Synchronized bundled GD library with GD 2.0.17
- Upgraded PCRE library to version 4.5. (Andrei)
- Added a warning when creating temp stream fails with ftp_(n)list(). (Sara)
- Fixed header handler in NSAPI SAPI module (header->replace was ignored,
send_default_content_type now sends value from php.ini). (Uwe Schindler)
-- Fixed bug #26896 (ext/ftp does not work as shared extension). (Jani)
- Fixed bug #26864 (pg_(update|delete) ignore PGSQL_DML_EXEC option). (Ilia)
- Fixed bug #26847 (memory leak in mail() when to/subject contain only spaces).
(Ilia)
currarg = 1;
while (inpos<Z_STRLEN_PP(args[0])) {
- int expprec = 0;
+ int expprec = 0, multiuse = 0;
+ zval *tmp;
PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos]));
PRINTF_DEBUG(("sprintf: outpos=%d\n", outpos));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zero is not a valid argument number");
return NULL;
}
-
+
+ multiuse = 1;
inpos++; /* skip the '$' */
} else {
argnum = currarg++;
}
PRINTF_DEBUG(("sprintf: format character='%c'\n", format[inpos]));
/* now we expect to find a type specifier */
+ if (multiuse) {
+ MAKE_STD_ZVAL(tmp);
+ *tmp = **(args[argnum]);
+ zval_copy_ctor(tmp);
+ } else {
+ tmp = *(args[argnum]);
+ }
+
switch (format[inpos]) {
case 's':
- convert_to_string_ex(args[argnum]);
+ convert_to_string(tmp);
php_sprintf_appendstring(&result, &outpos, &size,
- Z_STRVAL_PP(args[argnum]),
+ Z_STRVAL_P(tmp),
width, precision, padding,
alignment,
- Z_STRLEN_PP(args[argnum]),
+ Z_STRLEN_P(tmp),
0, expprec);
break;
case 'd':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_appendint(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
+ Z_LVAL_P(tmp),
width, padding, alignment,
always_sign);
break;
case 'u':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_appenduint(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
+ Z_LVAL_P(tmp),
width, padding, alignment,
always_sign);
break;
case 'e':
case 'f':
/* XXX not done */
- convert_to_double_ex(args[argnum]);
+ convert_to_double(tmp);
php_sprintf_appenddouble(&result, &outpos, &size,
- Z_DVAL_PP(args[argnum]),
+ Z_DVAL_P(tmp),
width, padding, alignment,
precision, adjusting,
format[inpos], always_sign
break;
case 'c':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_appendchar(&result, &outpos, &size,
- (char) Z_LVAL_PP(args[argnum]) TSRMLS_CC);
+ (char) Z_LVAL_P(tmp) TSRMLS_CC);
break;
case 'o':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
+ Z_LVAL_P(tmp),
width, padding, alignment, 3,
hexchars, expprec);
break;
case 'x':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
+ Z_LVAL_P(tmp),
width, padding, alignment, 4,
hexchars, expprec);
break;
case 'X':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
+ Z_LVAL_P(tmp),
width, padding, alignment, 4,
HEXCHARS, expprec);
break;
case 'b':
- convert_to_long_ex(args[argnum]);
+ convert_to_long(tmp);
php_sprintf_append2n(&result, &outpos, &size,
- Z_LVAL_PP(args[argnum]),
+ Z_LVAL_P(tmp),
width, padding, alignment, 1,
hexchars, expprec);
break;
default:
break;
}
+ if (multiuse) {
+ zval_ptr_dtor(&tmp);
+ }
inpos++;
}
}