Hi Derick,
in php-src/main/php_sprintf.c
PHPAPI int
php_sprintf (chars, const char format, ...)
{
va_list args;
char ret; //ret should be of type integer as vsprintf returns int
rather than char
va_start (args, format);
s[0] = '\0';
ret = vsprintf (s, format, args);
va_end (args);
if (!ret) //This check should be if(ret < 0) as ret will have the
number of characters printed to s
//If an output error is encountered, a negative value is returned.
return -1;
return strlen (s);
}
ret should be of type integer as vsprintf returns int rather than char*.
if (!ret) should be if(ret < 0)
With regards
Kamesh Jayachandran
Hi Derick,
in php-src/main/php_sprintf.c
PHPAPI int
php_sprintf (chars, const char format, ...)
{
va_list args;
char ret; //ret should be of type integer as vsprintf returns int rather than char
It is already an int, please update your source trees.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
Hi Derick,
Sorry I have seen this PHP-5.0.3 bundle. The change is there on December
17 commit on PHP5_0.
Still I feel this should be replaced
if (!ret)
return -1;
by
if (ret<0)
return -1;
As the document for vsprintf states as follows,
If an output error is encountered, a negative value is
returned.
With regards
Kamesh Jayachandran
On Tue, 4 Jan 2005 14:44:56 +0100 (CET), "Derick Rethans"
derick@php.net said:
Hi Derick,
in php-src/main/php_sprintf.c
PHPAPI int
php_sprintf (chars, const char format, ...)
{
va_list args;
char ret; //ret should be of type integer as vsprintf returns int rather than charIt is already an int, please update your source trees.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org