cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_execute_API.c zend_vm_def.h zend_vm_execute.h /tests ns_010.phpt ns_020.phpt ns_037.phpt
| From: | Dmitry Stogov | Date: | Fri, 27 Jul 2007 13:41:37 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_execute_API.c zend_vm_def.h zend_vm_execute.h /tests ns_010.phpt ns_020.phpt ns_037.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5931@lists.php.net to get a copy of this message | ||
dmitry Fri Jul 27 13:41:37 2007 UTC
Added files:
/ZendEngine2/tests ns_010.phpt ns_020.phpt ns_037.phpt
Modified files:
/ZendEngine2 zend_compile.c zend_compile.h zend_execute_API.c
zend_vm_def.h zend_vm_execute.h
Log:
Namespace support for name ambiguity between namespace and class name
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.759&r2=1.760&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.759 ZendEngine2/zend_compile.c:1.760 --- ZendEngine2/zend_compile.c:1.759 Fri Jul 27 09:04:12 2007 +++ ZendEngine2/zend_compile.c Fri Jul 27 13:41:35 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.759 2007/07/27 09:04:12 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.760 2007/07/27 13:41:35 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1642,6 +1642,14 @@ zval_copy_ctor(&class_name->u.constant); } else if (CG(current_namespace)) { zend_class_entry **pce; + unsigned int ns_lcname_len; + zstr ns_lcname = zend_u_str_case_fold(Z_TYPE_P(CG(current_namespace)), Z_UNIVAL_P(CG(current_namespace)), Z_UNILEN_P(CG(current_namespace)), 0, &ns_lcname_len); + + if (ns_lcname_len == lcname_len && + memcmp(lcname.v, ns_lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len) == 0) { + *fetch_type |= ZEND_FETCH_CLASS_RT_NS_NAME; + } + efree(ns_lcname.v); if (zend_u_hash_find(CG(class_table), Z_TYPE(class_name->u.constant), lcname, lcname_len+1, (void**)&pce) == SUCCESS && (*pce)->type == ZEND_INTERNAL_CLASS) { @@ -1729,7 +1737,7 @@ znode class_node; unsigned char *ptr = NULL; zend_op *opline; - ulong fetch_type; + ulong fetch_type = 0; if (method_name->op_type == IS_CONST) { zstr lcname; @@ -1755,10 +1763,8 @@ fetch_type = ZEND_FETCH_CLASS_GLOBAL; zend_resolve_class_name(class_name, &fetch_type TSRMLS_CC); class_node = *class_name; - fetch_type |= ZEND_FETCH_CLASS_RT_NS_CHECK; } else { zend_do_fetch_class(&class_node, class_name TSRMLS_CC); - fetch_type = 0; } opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.361&r2=1.362&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.361 ZendEngine2/zend_compile.h:1.362 --- ZendEngine2/zend_compile.h:1.361 Sat Jul 21 05:27:07 2007 +++ ZendEngine2/zend_compile.h Fri Jul 27 13:41:35 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.361 2007/07/21 05:27:07 pollita Exp $ */ +/* $Id: zend_compile.h,v 1.362 2007/07/27 13:41:35 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -634,6 +634,7 @@ #define ZEND_FETCH_CLASS_FLAGS 0xF0 #define ZEND_FETCH_CLASS_NO_NORMALIZE 0x10 #define ZEND_FETCH_CLASS_RT_NS_CHECK 0x20 +#define ZEND_FETCH_CLASS_RT_NS_NAME 0x40 #define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80 /* variable parsing type (compile-time) */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.409&r2=1.410&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.409 ZendEngine2/zend_execute_API.c:1.410 --- ZendEngine2/zend_execute_API.c:1.409 Sat Jul 21 05:27:07 2007 +++ ZendEngine2/zend_execute_API.c Fri Jul 27 13:41:35 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.409 2007/07/21 05:27:07 pollita Exp $ */ +/* $Id: zend_execute_API.c,v 1.410 2007/07/27 13:41:35 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -1653,6 +1653,7 @@ 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; @@ -1719,7 +1720,7 @@ } } } - if (use_autoload) { + if (use_autoload && !rt_ns_name) { 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.174&r2=1.175&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.174 ZendEngine2/zend_vm_def.h:1.175 --- ZendEngine2/zend_vm_def.h:1.174 Tue Jul 24 19:24:56 2007 +++ ZendEngine2/zend_vm_def.h Fri Jul 27 13:41:36 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.174 2007/07/24 19:24:56 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.175 2007/07/27 13:41:36 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1823,10 +1823,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.178&r2=1.179&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.178 ZendEngine2/zend_vm_execute.h:1.179 --- ZendEngine2/zend_vm_execute.h:1.178 Tue Jul 24 19:24:56 2007 +++ ZendEngine2/zend_vm_execute.h Fri Jul 27 13:41:36 2007 @@ -2575,10 +2575,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -3039,10 +3071,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -3504,10 +3568,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -3735,10 +3831,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -4168,10 +4296,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -10033,10 +10193,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -11729,10 +11921,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -13417,10 +13641,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -14303,10 +14559,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -15641,10 +15929,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_010.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/ns_010.phpt +++ ZendEngine2/tests/ns_010.phpt --TEST-- 010: Accesing internal namespace class --FILE-- <?php namespace X; import X as Y; class Foo { const C = "const ok\n"; function __construct() { echo "class ok\n"; } static function bar() { echo "method ok\n"; } } new Foo(); new X::Foo(); new Y::Foo(); new ::X::Foo(); Foo::bar(); X::Foo::bar(); Y::Foo::bar(); ::X::Foo::bar(); echo Foo::C; echo X::Foo::C; echo Y::Foo::C; echo ::X::Foo::C; --EXPECT-- class ok class ok class ok class ok method ok method ok method ok method ok const ok const ok const ok const ok http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_020.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/ns_020.phpt +++ ZendEngine2/tests/ns_020.phpt --TEST-- 020: Accesing internal namespace function --FILE-- <?php namespace X; import X as Y; function foo() { echo __FUNCTION__,"\n"; } foo(); X::foo(); Y::foo(); ::X::foo(); --EXPECT-- X::foo X::foo X::foo X::foo http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_037.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/ns_037.phpt +++ ZendEngine2/tests/ns_037.phpt --TEST-- 037: Name ambiguity (namespace name or namespace's class name) --FILE-- <?php namespace X; import X as Y; class X { const C = "const ok\n"; function __construct() { echo "class ok\n"; } static function bar() { echo "method ok\n"; } } new X(); new X::X(); new Y::X(); new ::X::X(); X::bar(); X::X::bar(); Y::X::bar(); ::X::X::bar(); echo X::C; echo X::X::C; echo Y::X::C; echo ::X::X::C; --EXPECT-- class ok class ok class ok class ok method ok method ok method ok method ok const ok const ok const ok const ok
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.759&r2=1.760&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.759 ZendEngine2/zend_compile.c:1.760 --- ZendEngine2/zend_compile.c:1.759 Fri Jul 27 09:04:12 2007 +++ ZendEngine2/zend_compile.c Fri Jul 27 13:41:35 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.759 2007/07/27 09:04:12 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.760 2007/07/27 13:41:35 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1642,6 +1642,14 @@ zval_copy_ctor(&class_name->u.constant); } else if (CG(current_namespace)) { zend_class_entry **pce; + unsigned int ns_lcname_len; + zstr ns_lcname = zend_u_str_case_fold(Z_TYPE_P(CG(current_namespace)), Z_UNIVAL_P(CG(current_namespace)), Z_UNILEN_P(CG(current_namespace)), 0, &ns_lcname_len); + + if (ns_lcname_len == lcname_len && + memcmp(lcname.v, ns_lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len) == 0) { + *fetch_type |= ZEND_FETCH_CLASS_RT_NS_NAME; + } + efree(ns_lcname.v); if (zend_u_hash_find(CG(class_table), Z_TYPE(class_name->u.constant), lcname, lcname_len+1, (void**)&pce) == SUCCESS && (*pce)->type == ZEND_INTERNAL_CLASS) { @@ -1729,7 +1737,7 @@ znode class_node; unsigned char *ptr = NULL; zend_op *opline; - ulong fetch_type; + ulong fetch_type = 0; if (method_name->op_type == IS_CONST) { zstr lcname; @@ -1755,10 +1763,8 @@ fetch_type = ZEND_FETCH_CLASS_GLOBAL; zend_resolve_class_name(class_name, &fetch_type TSRMLS_CC); class_node = *class_name; - fetch_type |= ZEND_FETCH_CLASS_RT_NS_CHECK; } else { zend_do_fetch_class(&class_node, class_name TSRMLS_CC); - fetch_type = 0; } opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.361&r2=1.362&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.361 ZendEngine2/zend_compile.h:1.362 --- ZendEngine2/zend_compile.h:1.361 Sat Jul 21 05:27:07 2007 +++ ZendEngine2/zend_compile.h Fri Jul 27 13:41:35 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.361 2007/07/21 05:27:07 pollita Exp $ */ +/* $Id: zend_compile.h,v 1.362 2007/07/27 13:41:35 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -634,6 +634,7 @@ #define ZEND_FETCH_CLASS_FLAGS 0xF0 #define ZEND_FETCH_CLASS_NO_NORMALIZE 0x10 #define ZEND_FETCH_CLASS_RT_NS_CHECK 0x20 +#define ZEND_FETCH_CLASS_RT_NS_NAME 0x40 #define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80 /* variable parsing type (compile-time) */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.409&r2=1.410&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.409 ZendEngine2/zend_execute_API.c:1.410 --- ZendEngine2/zend_execute_API.c:1.409 Sat Jul 21 05:27:07 2007 +++ ZendEngine2/zend_execute_API.c Fri Jul 27 13:41:35 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.409 2007/07/21 05:27:07 pollita Exp $ */ +/* $Id: zend_execute_API.c,v 1.410 2007/07/27 13:41:35 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -1653,6 +1653,7 @@ 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; @@ -1719,7 +1720,7 @@ } } } - if (use_autoload) { + if (use_autoload && !rt_ns_name) { 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.174&r2=1.175&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.174 ZendEngine2/zend_vm_def.h:1.175 --- ZendEngine2/zend_vm_def.h:1.174 Tue Jul 24 19:24:56 2007 +++ ZendEngine2/zend_vm_def.h Fri Jul 27 13:41:36 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.174 2007/07/24 19:24:56 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.175 2007/07/27 13:41:36 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1823,10 +1823,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.178&r2=1.179&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.178 ZendEngine2/zend_vm_execute.h:1.179 --- ZendEngine2/zend_vm_execute.h:1.178 Tue Jul 24 19:24:56 2007 +++ ZendEngine2/zend_vm_execute.h Fri Jul 27 13:41:36 2007 @@ -2575,10 +2575,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -3039,10 +3071,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -3504,10 +3568,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -3735,10 +3831,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -4168,10 +4296,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -10033,10 +10193,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -11729,10 +11921,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -13417,10 +13641,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -14303,10 +14559,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } @@ -15641,10 +15929,42 @@ EX(object) = NULL; ZEND_VM_NEXT_OPCODE(); } - efree(lcname.v); /* 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 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 & ZEND_FETCH_CLASS_RT_NS_NAME) ? (opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK) : opline->extended_value TSRMLS_CC); + + if (!ce) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_NAME) { + zstr ns; + + if (UG(unicode) && (ns.u = u_memchr(lcname.u, ':', lcname_len)) && ns.u[1] == ':') { + ns.u += 2; + lcname_len -= (ns.u - lcname.u); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } else if (!UG(unicode) && (ns.s = memchr(lcname.s, ':', lcname_len)) && ns.s[1] == ':') { + ns.s += 2; + lcname_len -= (ns.s - lcname.s); + if (zend_u_hash_find(EG(function_table), ZEND_STR_TYPE, ns, lcname_len+1, (void **) &EX(fbc))==SUCCESS) { + efree(lcname.v); + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } + } + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + ce = zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), ns, lcname_len, opline->extended_value & ~ZEND_FETCH_CLASS_RT_NS_CHECK TSRMLS_CC); + } 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)); + } + } + + efree(lcname.v); } else { ce = EX_T(opline->op1.u.var).class_entry; } http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_010.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/ns_010.phpt +++ ZendEngine2/tests/ns_010.phpt --TEST-- 010: Accesing internal namespace class --FILE-- <?php namespace X; import X as Y; class Foo { const C = "const ok\n"; function __construct() { echo "class ok\n"; } static function bar() { echo "method ok\n"; } } new Foo(); new X::Foo(); new Y::Foo(); new ::X::Foo(); Foo::bar(); X::Foo::bar(); Y::Foo::bar(); ::X::Foo::bar(); echo Foo::C; echo X::Foo::C; echo Y::Foo::C; echo ::X::Foo::C; --EXPECT-- class ok class ok class ok class ok method ok method ok method ok method ok const ok const ok const ok const ok http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_020.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/ns_020.phpt +++ ZendEngine2/tests/ns_020.phpt --TEST-- 020: Accesing internal namespace function --FILE-- <?php namespace X; import X as Y; function foo() { echo __FUNCTION__,"\n"; } foo(); X::foo(); Y::foo(); ::X::foo(); --EXPECT-- X::foo X::foo X::foo X::foo http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_037.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/ns_037.phpt +++ ZendEngine2/tests/ns_037.phpt --TEST-- 037: Name ambiguity (namespace name or namespace's class name) --FILE-- <?php namespace X; import X as Y; class X { const C = "const ok\n"; function __construct() { echo "class ok\n"; } static function bar() { echo "method ok\n"; } } new X(); new X::X(); new Y::X(); new ::X::X(); X::bar(); X::X::bar(); Y::X::bar(); ::X::X::bar(); echo X::C; echo X::X::C; echo Y::X::C; echo ::X::X::C; --EXPECT-- class ok class ok class ok class ok method ok method ok method ok method ok const ok const ok const ok const ok