mirror of
https://github.com/php/php-src.git
synced 2024-12-15 21:05:51 +08:00
Fixed return value of assert_options(ASSERT_CALLBACK) and possible crash (Andy Wharmby)
This commit is contained in:
parent
780c66d14b
commit
0262f05c17
@ -114,6 +114,16 @@ PHP_MSHUTDOWN_FUNCTION(assert)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(assert)
|
||||
{
|
||||
if (ASSERTG(cb)) {
|
||||
MAKE_STD_ZVAL(ASSERTG(callback));
|
||||
ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(assert)
|
||||
{
|
||||
if (ASSERTG(callback)) {
|
||||
@ -187,11 +197,6 @@ PHP_FUNCTION(assert)
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
if (!ASSERTG(callback) && ASSERTG(cb)) {
|
||||
MAKE_STD_ZVAL(ASSERTG(callback));
|
||||
ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1);
|
||||
}
|
||||
|
||||
if (ASSERTG(callback)) {
|
||||
zval *args[3];
|
||||
zval *retval;
|
||||
@ -286,6 +291,11 @@ PHP_FUNCTION(assert_options)
|
||||
break;
|
||||
|
||||
case ASSERT_CALLBACK:
|
||||
if (ASSERTG(callback) != NULL) {
|
||||
RETVAL_ZVAL(ASSERTG(callback), 1, 0);
|
||||
} else {
|
||||
RETVAL_NULL();
|
||||
}
|
||||
if (ac == 2) {
|
||||
if (ASSERTG(callback)) {
|
||||
zval_ptr_dtor(&ASSERTG(callback));
|
||||
@ -293,7 +303,7 @@ PHP_FUNCTION(assert_options)
|
||||
ASSERTG(callback) = *value;
|
||||
zval_add_ref(value);
|
||||
}
|
||||
RETURN_TRUE;
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -4132,6 +4132,7 @@ PHP_RINIT_FUNCTION(basic)
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
|
||||
#endif
|
||||
PHP_RINIT(assert) (INIT_FUNC_ARGS_PASSTHRU);
|
||||
PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
|
||||
PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user