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.
This commit is contained in:
Nikita Popov 2020-05-28 14:19:47 +02:00
parent d579e1809a
commit 70b2aa7fb8
3 changed files with 38 additions and 46 deletions

View file

@ -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));
}
/* }}} */