]> granicus.if.org Git - php/commitdiff
Fixed name resolution
authorDmitry Stogov <dmitry@php.net>
Wed, 22 Aug 2007 07:39:37 +0000 (07:39 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 22 Aug 2007 07:39:37 +0000 (07:39 +0000)
  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
Zend/tests/ns_026.phpt
Zend/zend_compile.c
Zend/zend_execute_API.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 467241ff34b4f43b984601a73c5acd4ab3e1536c..01609bb607b8ec23fca62ce096b80dd0473064a8 100755 (executable)
@@ -19,5 +19,5 @@ test::foo();
 test::test::foo();
 --EXPECT--
 test::foo
-test::Test::foo
+test::foo
 test::Test::foo
index 4a35919984e13dc510bf81f85b29ae3cbc812fa6..ad8654db5fc85b0a5598741028684491079392f8 100755 (executable)
@@ -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
index e5b390a89f151bf341de1bc0763681247bb2e06b..1a775062cc6927ea070f1b7041e197a94e823823 100644 (file)
@@ -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 *));
index 98276f08a726969f78a90d377a3e99525e84dcb7..8dfd69af2bc64422ee8d4836af94b40d4b483627 100644 (file)
@@ -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 {
index 546080118a5a9ef19d2d0621ec9c3914b5ecda21..f933a00cb50eed86942422251ab70e17bf311403 100644 (file)
@@ -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;
index fa46efb4d117bf2d17a94216439cb1da9420b431..590660c94573fd8b0b882041e1246b6658b6fe4c 100644 (file)
@@ -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;