mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Deprecate calling get_class() and get_parent_class() without arguments
This commit is contained in:
parent
4acf0084dc
commit
1126232053
9 changed files with 77 additions and 15 deletions
|
@ -557,6 +557,10 @@ ZEND_FUNCTION(get_class)
|
|||
zend_class_entry *scope = zend_get_executed_scope();
|
||||
|
||||
if (scope) {
|
||||
zend_error(E_DEPRECATED, "Calling get_class() without arguments is deprecated");
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
RETURN_STR_COPY(scope->name);
|
||||
} else {
|
||||
zend_throw_error(NULL, "get_class() without arguments must be called from within a class");
|
||||
|
@ -596,6 +600,10 @@ ZEND_FUNCTION(get_parent_class)
|
|||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (!ce) {
|
||||
zend_error(E_DEPRECATED, "Calling get_parent_class() without arguments is deprecated");
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
ce = zend_get_executed_scope();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue