summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-24 09:33:58 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-05-24 09:33:58 +0200
commite06ec226bc661acbf4d705e5bf02a11690b31baa (patch)
tree605cd08efccf83e32cb1f8c8c864e0758d4489c7 /Zend/zend_compile.c
parent378aeb86854a0e244b2f1528694b595660b7d533 (diff)
parent49a3b03e9fa3b6a7ef5302a48203b03e9d870ce9 (diff)
downloadphp-git-e06ec226bc661acbf4d705e5bf02a11690b31baa.tar.gz
Merge branch 'PHP-7.4'
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index d3bc68f893..99140e1818 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1121,14 +1121,16 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint3
if (first_early_binding_opline != (uint32_t)-1) {
zend_bool orig_in_compilation = CG(in_compilation);
uint32_t opline_num = first_early_binding_opline;
- zend_class_entry *ce;
CG(in_compilation) = 1;
while (opline_num != (uint32_t)-1) {
const zend_op *opline = &op_array->opcodes[opline_num];
+ zval *lcname = RT_CONSTANT(opline, opline->op1);
zval *parent_name = RT_CONSTANT(opline, opline->op2);
- if ((ce = zend_lookup_class_ex(Z_STR_P(parent_name), Z_STR_P(parent_name + 1), 0)) != NULL) {
- do_bind_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
+ zend_class_entry *ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(lcname + 1));
+ zend_class_entry *parent_ce = zend_lookup_class_ex(Z_STR_P(parent_name), Z_STR_P(parent_name + 1), 0);
+ if (ce && parent_ce && zend_can_early_bind(ce, parent_ce)) {
+ do_bind_class(lcname, parent_ce);
}
opline_num = op_array->opcodes[opline_num].result.opline_num;
}
@@ -6278,6 +6280,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD) /* delay inheritance till preloading */
&& ((parent_ce->type != ZEND_INTERNAL_CLASS) || !(CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES))
&& ((parent_ce->type != ZEND_USER_CLASS) || !(CG(compiler_options) & ZEND_COMPILE_IGNORE_OTHER_FILES) || (parent_ce->info.user.filename == ce->info.user.filename))
+ && zend_can_early_bind(ce, parent_ce)
) {
if (EXPECTED(zend_hash_add_ptr(CG(class_table), lcname, ce) != NULL)) {
CG(zend_lineno) = decl->end_lineno;