cvs: ZendEngine2 / zend_compile.c zend_execute_API.c zend_vm_def.h zend_vm_execute.h /tests ns_021.phpt ns_026.phpt

From: Date: Wed, 22 Aug 2007 07:39:37 +0000
Subject: cvs: ZendEngine2 / zend_compile.c zend_execute_API.c zend_vm_def.h zend_vm_execute.h /tests ns_021.phpt ns_026.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5964@lists.php.net to get a copy of this message
dmitry Wed Aug 22 07:39:37 2007 UTC Modified files: /ZendEngine2 zend_compile.c zend_execute_API.c zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests ns_021.phpt ns_026.phpt Log: 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"

http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.763&r2=1.764&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.763 ZendEngine2/zend_compile.c:1.764 --- ZendEngine2/zend_compile.c:1.763 Wed Aug 22 06:17:12 2007 +++ ZendEngine2/zend_compile.c Wed Aug 22 07:39:37 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.763 2007/08/22 06:17:12 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.764 2007/08/22 07:39:37 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1785,7 +1785,7 @@ } 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 @@ 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 @@ 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 @@ 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 *)); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.411&r2=1.412&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.411 ZendEngine2/zend_execute_API.c:1.412 --- ZendEngine2/zend_execute_API.c:1.411 Mon Aug 20 09:48:41 2007 +++ ZendEngine2/zend_execute_API.c Wed Aug 22 07:39:37 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.411 2007/08/20 09:48:41 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.412 2007/08/22 07:39:37 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -1655,7 +1655,6 @@ 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 @@ } } } - 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 { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.177&r2=1.178&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.177 ZendEngine2/zend_vm_def.h:1.178 --- ZendEngine2/zend_vm_def.h:1.177 Fri Aug 17 12:05:19 2007 +++ ZendEngine2/zend_vm_def.h Wed Aug 22 07:39:37 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.177 2007/08/17 12:05:19 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.178 2007/08/22 07:39:37 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1803,36 +1803,9 @@ } /* 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; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.181&r2=1.182&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.181 ZendEngine2/zend_vm_execute.h:1.182 --- ZendEngine2/zend_vm_execute.h:1.181 Fri Aug 17 12:05:19 2007 +++ ZendEngine2/zend_vm_execute.h Wed Aug 22 07:39:37 2007 @@ -2555,36 +2555,9 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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; http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_021.phpt?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/tests/ns_021.phpt diff -u ZendEngine2/tests/ns_021.phpt:1.1 ZendEngine2/tests/ns_021.phpt:1.2 --- ZendEngine2/tests/ns_021.phpt:1.1 Thu Jul 12 09:23:48 2007 +++ ZendEngine2/tests/ns_021.phpt Wed Aug 22 07:39:37 2007 @@ -19,5 +19,5 @@ test::test::foo(); --EXPECT-- test::foo -test::Test::foo +test::foo test::Test::foo http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_026.phpt?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/tests/ns_026.phpt diff -u ZendEngine2/tests/ns_026.phpt:1.1 ZendEngine2/tests/ns_026.phpt:1.2 --- ZendEngine2/tests/ns_026.phpt:1.1 Thu Jul 26 08:32:52 2007 +++ ZendEngine2/tests/ns_026.phpt Wed Aug 22 07:39:37 2007 @@ -24,7 +24,7 @@ ::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
« previous php.zend-engine.cvs (#5964) next »