summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-08-07 15:05:24 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-08-07 16:40:27 +0200
commit7991fc2753c9c15eeccb2a6384050a21c6ffaa71 (patch)
treeaf7d05682b9acbd2694645c1041472c949f375f9 /sapi
parent0400d07e613ac0e14bfceae0b5deda77062e319e (diff)
downloadphp-git-7991fc2753c9c15eeccb2a6384050a21c6ffaa71.tar.gz
Accept zend_object in zend_read_property
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cli/php_cli.c8
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c12
2 files changed, 9 insertions, 11 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 845312e9c6..4874e0920c 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1067,12 +1067,10 @@ static int do_cli(int argc, char **argv) /* {{{ */
pce->constructor, Z_OBJ(ref), NULL, &arg);
if (EG(exception)) {
- zval tmp, *msg, rv;
-
- ZVAL_OBJ(&tmp, EG(exception));
- msg = zend_read_property(zend_ce_exception, &tmp, "message", sizeof("message")-1, 0, &rv);
+ zval rv;
+ zval *msg = zend_read_property(zend_ce_exception, EG(exception), "message", sizeof("message")-1, 0, &rv);
zend_printf("Exception: %s\n", Z_STRVAL_P(msg));
- zval_ptr_dtor(&tmp);
+ zend_object_release(EG(exception));
EG(exception) = NULL;
} else {
zend_print_zval(&ref, 0);
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 9977adad4c..7647859222 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -726,8 +726,8 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
ZVAL_OBJ(&zv, ex);
zend_call_known_instance_method_with_0_params(ex->ce->__tostring, ex, &tmp);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
+ file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), Z_OBJ(zv), ZEND_STRL("file"), 1, &rv));
+ line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), Z_OBJ(zv), ZEND_STRL("line"), 1, &rv));
if (EG(exception)) {
EG(exception) = NULL;
@@ -735,7 +735,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
} else {
zend_update_property_string(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), Z_STRVAL(tmp));
zval_ptr_dtor(&tmp);
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), 1, &rv));
+ msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), Z_OBJ(zv), ZEND_STRL("string"), 1, &rv));
}
phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT, ZSTR_VAL(ex->ce->name), ZSTR_VAL(file), line);
@@ -1740,9 +1740,9 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
PHPDBG_G(handled_exception) = exception;
ZVAL_OBJ(&zv, exception);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("message"), 1, &rv));
+ file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), Z_OBJ(zv), ZEND_STRL("file"), 1, &rv));
+ line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), Z_OBJ(zv), ZEND_STRL("line"), 1, &rv));
+ msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), Z_OBJ(zv), ZEND_STRL("message"), 1, &rv));
phpdbg_error("exception",
"name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"",