Skip to content

Commit 74d15b5

Browse files
morrisonlevinikic
authored andcommitted
Remove do_bind_inherited_class; use do_bind_class
Pass NULL as the second parameter. I don't know if in the past these differed more, but there isn't any point to having both of them anymore.
1 parent b7b3a65 commit 74d15b5

File tree

4 files changed

+9
-34
lines changed

4 files changed

+9
-34
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,31 +1073,7 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
10731073
}
10741074
/* }}} */
10751075

1076-
ZEND_API int do_bind_class(zval *lcname) /* {{{ */
1077-
{
1078-
zend_class_entry *ce;
1079-
zval *rtd_key, *zv;
1080-
1081-
rtd_key = lcname + 1;
1082-
zv = zend_hash_find_ex(EG(class_table), Z_STR_P(rtd_key), 1);
1083-
if (UNEXPECTED(!zv)) {
1084-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s, because the name is already in use", Z_STRVAL_P(lcname));
1085-
return FAILURE;
1086-
}
1087-
1088-
ce = (zend_class_entry*)Z_PTR_P(zv);
1089-
zv = zend_hash_set_bucket_key(EG(class_table), (Bucket*)zv, Z_STR_P(lcname));
1090-
if (UNEXPECTED(!zv)) {
1091-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
1092-
return FAILURE;
1093-
}
1094-
1095-
zend_do_link_class(ce, NULL);
1096-
return SUCCESS;
1097-
}
1098-
/* }}} */
1099-
1100-
ZEND_API int do_bind_inherited_class(zval *lcname, zend_class_entry *parent_ce) /* {{{ */
1076+
ZEND_API int do_bind_class(zval *lcname, zend_class_entry *parent_ce) /* {{{ */
11011077
{
11021078
zend_class_entry *ce;
11031079
zval *rtd_key, *zv;
@@ -1192,7 +1168,7 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint3
11921168
const zend_op *opline = &op_array->opcodes[opline_num];
11931169
zval *parent_name = RT_CONSTANT(opline, opline->op2);
11941170
if ((ce = zend_lookup_class_ex(Z_STR_P(parent_name), Z_STR_P(parent_name + 1), 0)) != NULL) {
1195-
do_bind_inherited_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
1171+
do_bind_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
11961172
}
11971173
opline_num = op_array->opcodes[opline_num].result.opline_num;
11981174
}

Zend/zend_compile.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,7 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast);
750750
void zend_do_free(znode *op1);
751751

752752
ZEND_API int do_bind_function(zval *lcname);
753-
ZEND_API int do_bind_class(zval *lcname);
754-
ZEND_API int do_bind_inherited_class(zval *lcname, zend_class_entry *parent_ce);
753+
ZEND_API int do_bind_class(zval *lcname, zend_class_entry *parent_ce);
755754
ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array);
756755
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline);
757756

Zend/zend_vm_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6613,7 +6613,7 @@ ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, CONST, ANY)
66136613
USE_OPLINE
66146614

66156615
SAVE_OPLINE();
6616-
do_bind_class(RT_CONSTANT(opline, opline->op1));
6616+
do_bind_class(RT_CONSTANT(opline, opline->op1), NULL);
66176617
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
66186618
}
66196619

@@ -6630,7 +6630,7 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, CONST, CONST)
66306630
ZEND_ASSERT(EG(exception));
66316631
HANDLE_EXCEPTION();
66326632
}
6633-
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
6633+
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
66346634
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
66356635
}
66366636

@@ -6651,7 +6651,7 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, CONST, CONST)
66516651
ZEND_ASSERT(EG(exception));
66526652
HANDLE_EXCEPTION();
66536653
}
6654-
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
6654+
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
66556655
}
66566656
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
66576657
}

Zend/zend_vm_execute.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,7 +3544,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_CONST_HANDL
35443544
USE_OPLINE
35453545

35463546
SAVE_OPLINE();
3547-
do_bind_class(RT_CONSTANT(opline, opline->op1));
3547+
do_bind_class(RT_CONSTANT(opline, opline->op1), NULL);
35483548
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
35493549
}
35503550

@@ -5754,7 +5754,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_SPEC_C
57545754
ZEND_ASSERT(EG(exception));
57555755
HANDLE_EXCEPTION();
57565756
}
5757-
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
5757+
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
57585758
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
57595759
}
57605760

@@ -5775,7 +5775,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYE
57755775
ZEND_ASSERT(EG(exception));
57765776
HANDLE_EXCEPTION();
57775777
}
5778-
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
5778+
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
57795779
}
57805780
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
57815781
}

0 commit comments

Comments
 (0)