mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3'
* PHP-7.3: Fix #77291: magic methods inherited from a trait may be ignored
This commit is contained in:
commit
9216f5b92b
2 changed files with 53 additions and 11 deletions
|
@ -1178,17 +1178,7 @@ static void zend_do_implement_interfaces(zend_class_entry *ce) /* {{{ */
|
|||
|
||||
static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe) /* {{{ */
|
||||
{
|
||||
if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) {
|
||||
zend_string *lowercase_name = zend_string_tolower(ce->name);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name);
|
||||
if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) {
|
||||
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
|
||||
}
|
||||
ce->constructor = fe;
|
||||
}
|
||||
zend_string_release_ex(lowercase_name, 0);
|
||||
} else if (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_') {
|
||||
if (ZSTR_LEN(ce->name) != ZSTR_LEN(mname) && (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_')) {
|
||||
/* pass */
|
||||
} else if (zend_string_equals_literal(mname, ZEND_CLONE_FUNC_NAME)) {
|
||||
ce->clone = fe;
|
||||
|
@ -1219,6 +1209,16 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
|
|||
ce->__tostring = fe;
|
||||
} else if (zend_string_equals_literal(mname, ZEND_DEBUGINFO_FUNC_NAME)) {
|
||||
ce->__debugInfo = fe;
|
||||
} else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) {
|
||||
zend_string *lowercase_name = zend_string_tolower(ce->name);
|
||||
lowercase_name = zend_new_interned_string(lowercase_name);
|
||||
if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) {
|
||||
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
|
||||
}
|
||||
ce->constructor = fe;
|
||||
}
|
||||
zend_string_release_ex(lowercase_name, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue