From: Ilia Alshanetsky Date: Thu, 14 Aug 2003 00:38:21 +0000 (+0000) Subject: MFH: Fixed a possible crash due to invalid handling of assert ini options. X-Git-Tag: php-4.3.3RC4~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2c85181d0dff20cc6c1d61e4bd0d2542a04c0a2;p=php MFH: Fixed a possible crash due to invalid handling of assert ini options. --- diff --git a/ext/standard/assert.c b/ext/standard/assert.c index da3f525d14..2e707040ec 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -56,12 +56,9 @@ static PHP_INI_MH(OnChangeCallback) zval_ptr_dtor(&ASSERTG(callback)); } - MAKE_STD_ZVAL(ASSERTG(callback)); - - if (new_value) { + if (new_value && (ASSERTG(callback) || new_value_length)) { + MAKE_STD_ZVAL(ASSERTG(callback)); ZVAL_STRINGL(ASSERTG(callback), new_value, new_value_length, 1); - } else { - ZVAL_EMPTY_STRING(ASSERTG(callback)); } return SUCCESS; @@ -103,6 +100,7 @@ PHP_MSHUTDOWN_FUNCTION(assert) { if (ASSERTG(callback)) { zval_ptr_dtor(&ASSERTG(callback)); + ASSERTG(callback) = NULL; } return SUCCESS; }