summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-05-28 14:19:47 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-05-28 14:19:47 +0200
commit70b2aa7fb858670687bcfd35f8cc2649294d52e9 (patch)
tree839779b30789dce4a877a27e86626555e0577eb9 /Zend/zend_exceptions.c
parentd579e1809a8a9def6630bb2c880baf1861b1414b (diff)
downloadphp-git-70b2aa7fb858670687bcfd35f8cc2649294d52e9.tar.gz
Ensure Exception::getFile/getLine return type is correct
These return an untyped protected property, so we can't rely on the type being correct. Also add return types to the interface -- normally this would be a no-go, but Throwable is a special interface that can only be implemented internally, so we control all implementations.
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 6262685c47..a2bdbdad74 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -380,8 +380,7 @@ ZEND_METHOD(Exception, getFile)
ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_FILE);
- ZVAL_DEREF(prop);
- ZVAL_COPY(return_value, prop);
+ RETURN_STR(zval_get_string(prop));
}
/* }}} */
@@ -394,8 +393,7 @@ ZEND_METHOD(Exception, getLine)
ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_LINE);
- ZVAL_DEREF(prop);
- ZVAL_COPY(return_value, prop);
+ RETURN_LONG(zval_get_long(prop));
}
/* }}} */