Skip to content

Commit 2fe242d

Browse files
committed
Remove leftover handling of PHP4 constructors
This seems to be mapping ParentClass::ParentClass() to ParentClass::__construct(), but only for non-__construct ctors, which don't exist anymore.
1 parent 0806916 commit 2fe242d

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

Zend/zend_object_handlers.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,39 +1300,24 @@ static zend_always_inline zend_function *get_static_method_fallback(
13001300

13011301
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name, const zval *key) /* {{{ */
13021302
{
1303-
zend_function *fbc = NULL;
13041303
zend_string *lc_function_name;
1305-
zend_class_entry *scope;
1306-
13071304
if (EXPECTED(key != NULL)) {
13081305
lc_function_name = Z_STR_P(key);
13091306
} else {
13101307
lc_function_name = zend_string_tolower(function_name);
13111308
}
13121309

1313-
do {
1314-
zval *func = zend_hash_find(&ce->function_table, lc_function_name);
1315-
if (EXPECTED(func != NULL)) {
1316-
fbc = Z_FUNC_P(func);
1317-
} else if (ce->constructor
1318-
&& ZSTR_LEN(lc_function_name) == ZSTR_LEN(ce->name)
1319-
&& zend_binary_strncasecmp(ZSTR_VAL(lc_function_name), ZSTR_LEN(lc_function_name), ZSTR_VAL(ce->name), ZSTR_LEN(lc_function_name), ZSTR_LEN(lc_function_name)) == 0
1320-
/* Only change the method to the constructor if the constructor isn't called __construct
1321-
* we check for __ so we can be binary safe for lowering, we should use ZEND_CONSTRUCTOR_FUNC_NAME
1322-
*/
1323-
&& (ZSTR_VAL(ce->constructor->common.function_name)[0] != '_'
1324-
|| ZSTR_VAL(ce->constructor->common.function_name)[1] != '_')) {
1325-
fbc = ce->constructor;
1326-
} else {
1327-
if (UNEXPECTED(!key)) {
1328-
zend_string_release_ex(lc_function_name, 0);
1329-
}
1330-
return get_static_method_fallback(ce, function_name);
1310+
zval *func = zend_hash_find(&ce->function_table, lc_function_name);
1311+
if (UNEXPECTED(!func)) {
1312+
if (UNEXPECTED(!key)) {
1313+
zend_string_release_ex(lc_function_name, 0);
13311314
}
1332-
} while (0);
1315+
return get_static_method_fallback(ce, function_name);
1316+
}
13331317

1318+
zend_function *fbc = Z_FUNC_P(func);
13341319
if (!(fbc->op_array.fn_flags & ZEND_ACC_PUBLIC)) {
1335-
scope = zend_get_executed_scope();
1320+
zend_class_entry *scope = zend_get_executed_scope();
13361321
if (UNEXPECTED(fbc->common.scope != scope)) {
13371322
if (UNEXPECTED(fbc->op_array.fn_flags & ZEND_ACC_PRIVATE)
13381323
|| UNEXPECTED(!zend_check_protected(zend_get_function_root_class(fbc), scope))) {

0 commit comments

Comments
 (0)