FATAL error on invalid data? That looks wrong. Can't you make it a warning instead?
On 05/04/2011 11:53 AM, Dmitry Stogov wrote:
dmitry Wed, 04 May 2011 07:53:22 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=310753 Log: Fixed crash when passing invalid timestamp (negative integer on win32) Changed paths: U php/php-src/branches/PHP_5_2/ext/soap/php_encoding.c U php/php-src/branches/PHP_5_3/ext/soap/php_encoding.c U php/php-src/trunk/ext/soap/php_encoding.c Modified: php/php-src/branches/PHP_5_2/ext/soap/php_encoding.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/soap/php_encoding.c 2011-05-04 05:39:17 UTC (rev 310752) +++ php/php-src/branches/PHP_5_2/ext/soap/php_encoding.c 2011-05-04 07:53:22 UTC (rev 310753) @@ -2872,6 +2872,9 @@ timestamp = Z_LVAL_P(data); ta = php_localtime_r(×tamp,&tmbuf); /*ta = php_gmtime_r(×tamp,&tmbuf);*/ + if (!ta) { + soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_LVAL_P(data)); + } buf = (char *) emalloc(buf_len); while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || real_len == 0) { Modified: php/php-src/branches/PHP_5_3/ext/soap/php_encoding.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/soap/php_encoding.c 2011-05-04 05:39:17 UTC (rev 310752) +++ php/php-src/branches/PHP_5_3/ext/soap/php_encoding.c 2011-05-04 07:53:22 UTC (rev 310753) @@ -2984,6 +2984,9 @@ timestamp = Z_LVAL_P(data); ta = php_localtime_r(×tamp,&tmbuf); /*ta = php_gmtime_r(×tamp,&tmbuf);*/ + if (!ta) { + soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_LVAL_P(data)); + } buf = (char *) emalloc(buf_len); while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || real_len == 0) { Modified: php/php-src/trunk/ext/soap/php_encoding.c =================================================================== --- php/php-src/trunk/ext/soap/php_encoding.c 2011-05-04 05:39:17 UTC (rev 310752) +++ php/php-src/trunk/ext/soap/php_encoding.c 2011-05-04 07:53:22 UTC (rev 310753) @@ -2962,6 +2962,9 @@ timestamp = Z_LVAL_P(data); ta = php_localtime_r(×tamp,&tmbuf); /*ta = php_gmtime_r(×tamp,&tmbuf);*/ + if (!ta) { + soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_LVAL_P(data)); + } buf = (char *) emalloc(buf_len); while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || real_len == 0) {
-- Wbr, Antony Dovgal --- http://pinba.org - realtime statistics for PHP -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php