diff options
Diffstat (limited to 'ext/standard/assert.c')
-rw-r--r-- | ext/standard/assert.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 02e330cba5..0a384e2ec0 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2017 The PHP Group | + | Copyright (c) 1997-2018 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -164,7 +164,10 @@ PHP_FUNCTION(assert) if (Z_TYPE_P(assertion) == IS_STRING) { zval retval; int old_error_reporting = 0; /* shut up gcc! */ - zend_class_entry *orig_scope = EG(scope); + + if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) { + RETURN_FALSE; + } myeval = Z_STRVAL_P(assertion); @@ -177,10 +180,10 @@ PHP_FUNCTION(assert) if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) { efree(compiled_string_description); if (!description) { - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); + zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval); } else { zend_string *str = zval_get_string(description); - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); + zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); zend_string_release(str); } if (ASSERTG(bail)) { @@ -194,8 +197,6 @@ PHP_FUNCTION(assert) EG(error_reporting) = old_error_reporting; } - EG(scope) = orig_scope; - convert_to_boolean(&retval); val = Z_TYPE(retval) == IS_TRUE; } else { @@ -369,7 +370,7 @@ PHP_FUNCTION(assert_options) break; default: - php_error_docref(NULL, E_WARNING, "Unknown value %pd", what); + php_error_docref(NULL, E_WARNING, "Unknown value " ZEND_LONG_FMT, what); break; } |