From: Michael Wallner Date: Wed, 30 Dec 2009 15:00:36 +0000 (+0000) Subject: * attempt to fix pecl Bug #16826 http_date strange behavior and crash X-Git-Tag: RELEASE_1_7_0~19 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=eef82b527f14c30a7c4bd9056e704e306ae97409 * attempt to fix pecl Bug #16826 http_date strange behavior and crash --- diff --git a/http_functions.c b/http_functions.c index 94b62bf..4e10f16 100644 --- a/http_functions.c +++ b/http_functions.c @@ -43,6 +43,7 @@ PHP_FUNCTION(http_date) { long t = -1; + char *date; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &t) != SUCCESS) { RETURN_FALSE; @@ -52,7 +53,12 @@ PHP_FUNCTION(http_date) t = HTTP_G->request.time; } - RETURN_STRING(http_date(t), 0); + if (!(date = http_date(t))) { + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Could not compose date of timestamp %ld", t); + RETURN_FALSE; + } + + RETURN_STRING(date, 0); } /* }}} */