From 046b878b5bb997db890274f9f1ea804c2106ec80 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 22 Aug 2007 07:39:37 +0000 Subject: Fixed name resolution namespace A; B::foo(); // 1. this is function "foo" from namespace "B" // 2. this is static method "foo" of class "B" from namespace "A" // 3. this is static methos "boo" of internal class "B" namespace A; A::foo(); // 1. this is function "foo" from namespace "A" // 2. this is static method "foo" of class "A" from namespace "A" // 3. this is static methos "foo" of internal class "A" --- Zend/tests/ns_021.phpt | 2 +- Zend/tests/ns_026.phpt | 2 +- Zend/zend_compile.c | 53 ++++----- Zend/zend_execute_API.c | 3 +- Zend/zend_vm_def.h | 31 +---- Zend/zend_vm_execute.h | 310 ++++-------------------------------------------- 6 files changed, 49 insertions(+), 352 deletions(-) diff --git a/Zend/tests/ns_021.phpt b/Zend/tests/ns_021.phpt index 467241ff34..01609bb607 100755 --- a/Zend/tests/ns_021.phpt +++ b/Zend/tests/ns_021.phpt @@ -19,5 +19,5 @@ test::foo(); test::test::foo(); --EXPECT-- test::foo -test::Test::foo +test::foo test::Test::foo diff --git a/Zend/tests/ns_026.phpt b/Zend/tests/ns_026.phpt index 4a35919984..ad8654db5f 100755 --- a/Zend/tests/ns_026.phpt +++ b/Zend/tests/ns_026.phpt @@ -24,7 +24,7 @@ Foo::Foo::Bar(); ::Foo::Bar(); --EXPECT-- Method - Foo::Foo::__construct -Method - Foo::Foo::Bar +Func - Foo::Bar Method - Foo::Foo::__construct Method - Foo::Foo::Bar Func - Foo::Bar diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e5b390a89f..1a775062cc 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1785,7 +1785,7 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *method_n } opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; - opline->extended_value = fetch_type; + opline->extended_value = fetch_type & ~ZEND_FETCH_CLASS_RT_NS_NAME; opline->op1 = class_node; opline->op2 = *method_name; @@ -1793,21 +1793,33 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *method_n method_name->op_type == IS_CONST) { /* Prebuild ns::func name to speedup run-time check. The additional names are stored in additional OP_DATA opcode. */ - zstr fname, lcname; - unsigned int len, lcname_len; + zstr nsname, fname, lcname; + unsigned int nsname_len, len, lcname_len; opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_OP_DATA; opline->op1.op_type = IS_CONST; SET_UNUSED(opline->op2); - len = Z_UNILEN(class_node.u.constant) + 2 + Z_UNILEN(method_name->u.constant); + nsname = Z_UNIVAL(class_node.u.constant); + nsname_len = Z_UNILEN(class_node.u.constant); + if (fetch_type & ZEND_FETCH_CLASS_RT_NS_NAME) { + /* Remove namespace name */ + if (UG(unicode)) { + nsname.u = u_memchr(nsname.u, ':', nsname_len) + 2; + nsname_len -= (nsname.u - Z_USTRVAL(class_node.u.constant)); + } else { + nsname.s = memchr(nsname.s, ':', nsname_len) + 2; + nsname_len -= (nsname.s - Z_STRVAL(class_node.u.constant)); + } + } + len = nsname_len + 2 + Z_UNILEN(method_name->u.constant); if (UG(unicode)) { fname.u = eumalloc(len + 1); - memcpy(fname.u, Z_USTRVAL(class_node.u.constant), UBYTES(Z_USTRLEN(class_node.u.constant))); - fname.u[Z_USTRLEN(class_node.u.constant)] = ':'; - fname.u[Z_USTRLEN(class_node.u.constant)+1] = ':'; - memcpy(fname.u+Z_USTRLEN(class_node.u.constant)+2, + memcpy(fname.u, nsname.u, UBYTES(nsname_len)); + fname.u[nsname_len] = ':'; + fname.u[nsname_len + 1] = ':'; + memcpy(fname.u + nsname_len + 2, Z_USTRVAL(method_name->u.constant), UBYTES(Z_USTRLEN(method_name->u.constant)+1)); lcname = zend_u_str_case_fold(IS_UNICODE, fname, len, 1, &lcname_len); @@ -1815,10 +1827,10 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *method_n ZVAL_UNICODEL(&opline->op1.u.constant, lcname.u, lcname_len, 0); } else { fname.s = emalloc(len + 1); - memcpy(fname.s, Z_STRVAL(class_node.u.constant), Z_STRLEN(class_node.u.constant)); - fname.s[Z_STRLEN(class_node.u.constant)] = ':'; - fname.s[Z_STRLEN(class_node.u.constant)+1] = ':'; - memcpy(fname.s+Z_STRLEN(class_node.u.constant)+2, + memcpy(fname.s, nsname.s, nsname_len); + fname.s[nsname_len] = ':'; + fname.s[nsname_len + 1] = ':'; + memcpy(fname.s + nsname_len + 2, Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)+1); lcname = zend_u_str_case_fold(IS_STRING, fname, len, 1, &lcname_len); @@ -1826,23 +1838,6 @@ void zend_do_begin_class_member_function_call(znode *class_name, znode *method_n ZVAL_STRINGL(&opline->op1.u.constant, lcname.s, lcname_len, 0); } efree(fname.v); - - if (fetch_type & ZEND_FETCH_CLASS_RT_NS_NAME) { - /* Prebuild name without first part of compound name for cases - when name is equal to current namespace name. This will speedup - runtime check. */ - zstr colon; - - if (UG(unicode) && (colon.u = u_memchr(lcname.u, ':', lcname_len)) && colon.u[1] == ':') { - colon.u += 2; - opline->op2.op_type = IS_CONST; - ZVAL_UNICODEL(&opline->op2.u.constant, colon.u, lcname_len - (colon.u - lcname.u), 1); - } else if (!UG(unicode) && (colon.s = memchr(lcname.s, ':', lcname_len)) && colon.s[1] == ':') { - colon.s += 2; - opline->op2.op_type = IS_CONST; - ZVAL_STRINGL(&opline->op2.u.constant, colon.s, lcname_len - (colon.s - lcname.s), 1); - } - } } zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 98276f08a7..8dfd69af2b 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1655,7 +1655,6 @@ ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) ? 0 : 1; int do_normalize = (fetch_type & ZEND_FETCH_CLASS_NO_NORMALIZE) ? 0 : 1; int rt_ns_check = (fetch_type & ZEND_FETCH_CLASS_RT_NS_CHECK) ? 1 : 0; - int rt_ns_name = (fetch_type & ZEND_FETCH_CLASS_RT_NS_NAME) ? 1 : 0; zstr lcname = class_name; fetch_type = fetch_type & ~ZEND_FETCH_CLASS_FLAGS; @@ -1722,7 +1721,7 @@ check_fetch_type: } } } - if (use_autoload && !rt_ns_name) { + if (use_autoload) { if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) { zend_error(E_ERROR, "Interface '%R' not found", type, class_name); } else { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 546080118a..f933a00cb5 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1803,36 +1803,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index fa46efb4d1..590660c945 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2555,36 +2555,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HAN } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -3026,36 +2999,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDL } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -3498,36 +3444,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDL } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -3736,36 +3655,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HA } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -4176,36 +4068,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLE } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -10048,36 +9913,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDL } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -11751,36 +11589,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -13446,36 +13257,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -14339,36 +14123,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; @@ -15684,36 +15441,9 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ } /* no function found. try a static method in class */ - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); - + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { - if ((opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) && - op_data->op2.op_type == IS_CONST) { - - if (zend_u_hash_find(EG(function_table), Z_TYPE(op_data->op2.u.constant), Z_UNIVAL(op_data->op2.u.constant), Z_UNILEN(op_data->op2.u.constant) + 1, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zstr ce_name; - unsigned ce_name_len = Z_UNILEN(op_data->op1.u.constant) - (Z_UNILEN(op_data->op2.u.constant) + 2); - if (UG(unicode)) { - ce_name.u = eustrndup(Z_USTRVAL(op_data->op1.u.constant), ce_name_len); - } else { - ce_name.s = estrndup(Z_STRVAL(op_data->op1.u.constant), ce_name_len); - } - ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ce_name, ce_name_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); - efree(ce_name.v); - if (!ce) { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } - } else { - zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); - } + zend_error(E_ERROR, "Class '%R' not found", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant)); } } else { ce = EX_T(opline->op1.u.var).class_entry; -- cgit v1.2.1