Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40477 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66506 invoked from network); 12 Sep 2008 03:15:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2008 03:15:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 208.83.222.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 208.83.222.18 unknown Linux 2.6 Received: from [208.83.222.18] ([208.83.222.18:38997] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/A2-49770-6BED9C84 for ; Thu, 11 Sep 2008 23:15:03 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id B950DC0F33D for ; Thu, 11 Sep 2008 20:14:13 -0700 (MST) Received: from [192.168.223.130] (CPE-76-84-4-101.neb.res.rr.com [76.84.4.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id D1B96C0F33C for ; Thu, 11 Sep 2008 20:14:11 -0700 (MST) Message-ID: <48C9DEB1.7070404@chiaraquartet.net> Date: Thu, 11 Sep 2008 22:14:57 -0500 User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: internals@lists.php.net Content-Type: multipart/mixed; boundary="------------030602080601070103090504" X-Virus-Scanned: ClamAV using ClamSMTP Subject: [PATCH] updated resolve function/const conflict between namespace/class From: greg@chiaraquartet.net (Greg Beaver) --------------030602080601070103090504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, The attached updated patch (which is also available at http://pear.php.net/~greg/resolvensfuncconst.patch.txt) adds support for call_user_func() resolution of the new function::blah format, as in: call_user_func('function::blah'); and adds a missing ns_071.inc file in the Zend/tests directory. Otherwise, it is identical to the previous patch in my message from yesterday. With the three patches I have posted for namespaces, all critical issues are resolved, leaving the sugar questions of namespace {} versus namespace; and other minor points raised by Liz Smith in her recent blog post on the subject. Greg --------------030602080601070103090504 Content-Type: text/plain; name="resolvensfuncconst.patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="resolvensfuncconst.patch.txt" Index: Zend/zend_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_API.c,v retrieving revision 1.296.2.27.2.34.2.53 diff -u -u -r1.296.2.27.2.34.2.53 zend_API.c --- Zend/zend_API.c 22 Aug 2008 14:51:30 -0000 1.296.2.27.2.34.2.53 +++ Zend/zend_API.c 12 Sep 2008 03:07:31 -0000 @@ -2406,6 +2406,16 @@ mname = Z_STRVAL_P(callable); lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); } + if (mlen > sizeof("function::") && !memcmp(mname, "function::", sizeof("function::")-1)) { + /* Check if function with given name exists. + * This may be a compound name that includes namespace name */ + if (zend_hash_find(EG(function_table), lmname+sizeof("function::")-1, mlen+1-(sizeof("function::")-1), (void**)&fcc->function_handler) == SUCCESS) { + efree(lmname); + return 1; + } + efree(lmname); + return 0; + } /* Check if function with given name exists. * This may be a compound name that includes namespace name */ if (zend_hash_find(EG(function_table), lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) { Index: Zend/zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.647.2.27.2.41.2.85 diff -u -u -r1.647.2.27.2.41.2.85 zend_compile.c --- Zend/zend_compile.c 29 Aug 2008 10:17:08 -0000 1.647.2.27.2.41.2.85 +++ Zend/zend_compile.c 12 Sep 2008 03:07:37 -0000 @@ -1920,7 +1920,7 @@ result->u.constant.value.str.len = length; } -int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) +int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name, int is_function TSRMLS_DC) { znode class_node; unsigned char *ptr = NULL; @@ -1964,7 +1964,11 @@ zend_do_fetch_class(&class_node, class_name TSRMLS_CC); } opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; + if (is_function) { + opline->opcode = ZEND_INIT_NS_FUNCTION_CALL; + } else { + opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; + } opline->extended_value = fetch_type & ~ZEND_FETCH_CLASS_RT_NS_NAME; opline->op1 = class_node; opline->op2 = *method_name; @@ -3813,7 +3817,7 @@ } /* }}} */ -void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC) /* {{{ */ +void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace, int is_const TSRMLS_DC) /* {{{ */ { ulong fetch_type = 0; znode tmp; @@ -3880,7 +3884,11 @@ fetch_type |= IS_CONSTANT_RT_NS_CHECK; } opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_FETCH_CONSTANT; + if (is_const) { + opline->opcode = ZEND_FETCH_NS_CONSTANT; + } else { + opline->opcode = ZEND_FETCH_CONSTANT; + } opline->extended_value = fetch_type & ~ZEND_FETCH_CLASS_RT_NS_NAME; opline->result.op_type = IS_TMP_VAR; opline->result.u.var = get_temporary_variable(CG(active_op_array)); Index: Zend/zend_compile.h =================================================================== RCS file: /repository/ZendEngine2/zend_compile.h,v retrieving revision 1.316.2.8.2.12.2.33 diff -u -u -r1.316.2.8.2.12.2.33 zend_compile.h --- Zend/zend_compile.h 29 Aug 2008 18:12:47 -0000 1.316.2.8.2.12.2.33 +++ Zend/zend_compile.h 12 Sep 2008 03:07:37 -0000 @@ -428,7 +428,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int prefix_len TSRMLS_DC); void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC); void zend_do_build_full_name(znode *result, znode *prefix, znode *name TSRMLS_DC); -int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC); +int zend_do_begin_class_member_function_call(znode *class_name, znode *method_name, int is_function TSRMLS_DC); void zend_do_end_function_call(znode *function_name, znode *result, const znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC); void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC); void zend_do_handle_exception(TSRMLS_D); @@ -485,7 +485,7 @@ void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC); void zend_do_end_new_object(znode *result, const znode *new_token, const znode *argument_list TSRMLS_DC); -void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC); +void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode, zend_bool check_namespace, int is_const TSRMLS_DC); void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC); Index: Zend/zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.160.2.4.2.8.2.26 diff -u -u -r1.160.2.4.2.8.2.26 zend_language_parser.y --- Zend/zend_language_parser.y 29 Aug 2008 17:54:29 -0000 1.160.2.4.2.8.2.26 +++ Zend/zend_language_parser.y 12 Sep 2008 03:07:46 -0000 @@ -671,16 +671,19 @@ | T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $3.u.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$2, &$$, &$5, 0, $3.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $4.u.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $4.u.opline_num = zend_do_begin_class_member_function_call(&$1, &$3, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call($4.u.opline_num?NULL:&$3, &$$, &$6, $4.u.opline_num, $4.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | T_FUNCTION T_PAAMAYIM_NEKUDOTAYIM class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $6.u.opline_num = zend_do_begin_class_member_function_call(&$3, &$5, 1 TSRMLS_CC); } + function_call_parameter_list + ')' { zend_do_end_function_call($6.u.opline_num?NULL:&$5, &$$, &$8, $6.u.opline_num, $6.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} + | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | variable_without_objects '(' { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); } @@ -766,8 +769,8 @@ static_scalar: /* compile-time evaluated scalars */ common_scalar { $$ = $1; } - | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); } - | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); } + | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1, 0 TSRMLS_CC); } + | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0, 0 TSRMLS_CC); } | '+' static_scalar { ZVAL_LONG(&$1.u.constant, 0); add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | '-' static_scalar { ZVAL_LONG(&$1.u.constant, 0); sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } @@ -775,12 +778,13 @@ ; static_class_constant: - class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); } + T_CONST T_PAAMAYIM_NEKUDOTAYIM namespace_name { zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0, 1 TSRMLS_CC); } + | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0, 0 TSRMLS_CC); } ; scalar: - T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); } - | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } + T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1, 0 TSRMLS_CC); } + | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0, 0 TSRMLS_CC); } | T_STRING_VARNAME { $$ = $1; } | class_constant { $$ = $1; } | common_scalar { $$ = $1; } @@ -989,8 +993,9 @@ ; class_constant: - class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); } - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); } + T_CONST T_PAAMAYIM_NEKUDOTAYIM namespace_name { zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0, 1 TSRMLS_CC); } + | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0, 0 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0, 0 TSRMLS_CC); } ; %% Index: Zend/zend_vm_def.h =================================================================== RCS file: /repository/ZendEngine2/zend_vm_def.h,v retrieving revision 1.59.2.29.2.48.2.70 diff -u -u -r1.59.2.29.2.48.2.70 zend_vm_def.h --- Zend/zend_vm_def.h 15 Aug 2008 19:47:28 -0000 1.59.2.29.2.48.2.70 +++ Zend/zend_vm_def.h 12 Sep 2008 03:07:58 -0000 @@ -1957,19 +1957,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (OP1_TYPE == IS_CONST && OP2_TYPE == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -2008,6 +2007,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (OP1_TYPE == IS_CONST && OP2_TYPE == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -2055,6 +2063,25 @@ ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(154, ZEND_INIT_NS_FUNCTION_CALL, CONST, CONST) +{ + zend_op *opline = EX(opline); + zend_op *op_data = opline+1; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + /* try a function in namespace */ + + ZEND_VM_INC_OPCODE(); + + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) { zend_op *opline = EX(opline); @@ -3001,27 +3028,27 @@ ZEND_VM_INC_OPCODE(); - /* try a constant in namespace */ - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { - EX_T(opline->result.u.var).tmp_var = c->value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); - } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); - } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - Z_STRVAL(opline->op2.u.constant), - Z_STRVAL(opline->op2.u.constant)); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + /* try a constant in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); } - ZEND_VM_NEXT_OPCODE(); - } - /* no constant found. try a constant in class */ - ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); - if (!ce) { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } } else { @@ -3040,6 +3067,27 @@ EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { + if (OP1_TYPE == IS_CONST) { + zend_op *op_data = opline + 1; + zend_constant *c; + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } @@ -3047,6 +3095,50 @@ } } +ZEND_VM_HANDLER(155, ZEND_FETCH_NS_CONSTANT, UNUSED|CONST, CONST) +{ + zend_op *opline = EX(opline); + + if (OP1_TYPE == IS_UNUSED) { + if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } else { + zend_op *op_data = opline + 1; + zend_constant *c; + + ZEND_VM_INC_OPCODE(); + + /* try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUSED|CV) { zend_op *opline = EX(opline); Index: Zend/zend_vm_execute.h =================================================================== RCS file: /repository/ZendEngine2/zend_vm_execute.h,v retrieving revision 1.62.2.30.2.49.2.70 diff -u -u -r1.62.2.30.2.49.2.70 zend_vm_execute.h --- Zend/zend_vm_execute.h 15 Aug 2008 19:47:28 -0000 1.62.2.30.2.49.2.70 +++ Zend/zend_vm_execute.h 12 Sep 2008 03:08:16 -0000 @@ -2604,19 +2604,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_CONST == IS_CONST && IS_CONST == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -2655,6 +2654,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_CONST == IS_CONST && IS_CONST == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -2702,6 +2710,25 @@ ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_INIT_NS_FUNCTION_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zend_op *op_data = opline+1; + + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); + + /* try a function in namespace */ + + ZEND_VM_INC_OPCODE(); + + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2759,27 +2786,27 @@ ZEND_VM_INC_OPCODE(); - /* try a constant in namespace */ - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { - EX_T(opline->result.u.var).tmp_var = c->value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); - } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); - } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - Z_STRVAL(opline->op2.u.constant), - Z_STRVAL(opline->op2.u.constant)); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + /* try a constant in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); } - ZEND_VM_NEXT_OPCODE(); - } - /* no constant found. try a constant in class */ - ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); - if (!ce) { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } } else { @@ -2798,6 +2825,27 @@ EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { + if (IS_CONST == IS_CONST) { + zend_op *op_data = opline + 1; + zend_constant *c; + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } @@ -2805,6 +2853,50 @@ } } +static int ZEND_FASTCALL ZEND_FETCH_NS_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + if (IS_CONST == IS_UNUSED) { + if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } else { + zend_op *op_data = opline + 1; + zend_constant *c; + + ZEND_VM_INC_OPCODE(); + + /* try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -3200,19 +3292,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_CONST == IS_CONST && IS_TMP_VAR == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -3251,6 +3342,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_CONST == IS_CONST && IS_TMP_VAR == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -3676,19 +3776,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_CONST == IS_CONST && IS_VAR == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -3727,6 +3826,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_CONST == IS_CONST && IS_VAR == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -3908,19 +4016,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_CONST == IS_CONST && IS_UNUSED == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -3959,6 +4066,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_CONST == IS_CONST && IS_UNUSED == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -4352,19 +4468,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_CONST == IS_CONST && IS_CV == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -4403,6 +4518,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_CONST == IS_CONST && IS_CV == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -10345,19 +10469,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_VAR == IS_CONST && IS_CONST == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -10396,6 +10519,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_VAR == IS_CONST && IS_CONST == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -10500,27 +10632,27 @@ ZEND_VM_INC_OPCODE(); - /* try a constant in namespace */ - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { - EX_T(opline->result.u.var).tmp_var = c->value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); - } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); - } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - Z_STRVAL(opline->op2.u.constant), - Z_STRVAL(opline->op2.u.constant)); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + /* try a constant in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); } - ZEND_VM_NEXT_OPCODE(); - } - /* no constant found. try a constant in class */ - ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); - if (!ce) { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } } else { @@ -10539,6 +10671,27 @@ EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { + if (IS_VAR == IS_CONST) { + zend_op *op_data = opline + 1; + zend_constant *c; + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } @@ -12199,19 +12352,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_VAR == IS_CONST && IS_TMP_VAR == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -12250,6 +12402,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_VAR == IS_CONST && IS_TMP_VAR == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -14033,19 +14194,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_VAR == IS_CONST && IS_VAR == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -14084,6 +14244,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_VAR == IS_CONST && IS_VAR == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -14960,19 +15129,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_VAR == IS_CONST && IS_UNUSED == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -15011,6 +15179,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_VAR == IS_CONST && IS_UNUSED == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -16481,19 +16658,18 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); if (IS_VAR == IS_CONST && IS_CV == IS_CONST) { - /* try a function in namespace */ zend_op *op_data = opline+1; ZEND_VM_INC_OPCODE(); - if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { - EX(object) = NULL; - ZEND_VM_NEXT_OPCODE(); - } - - /* no function found. try a static method in class */ + /* try a static method in class */ ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); if (!ce) { + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + ZEND_VM_NEXT_OPCODE(); + } zend_error(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); } EX(called_scope) = ce; @@ -16532,6 +16708,15 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); } if (!EX(fbc)) { + if (IS_VAR == IS_CONST && IS_CV == IS_CONST) { + zend_op *op_data = opline+1; + /* try a function in namespace */ + if (zend_hash_quick_find(EG(function_table), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==SUCCESS) { + EX(object) = NULL; + EX(called_scope) = EG(called_scope); + ZEND_VM_NEXT_OPCODE(); + } + } zend_error(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); } } @@ -17871,27 +18056,27 @@ ZEND_VM_INC_OPCODE(); - /* try a constant in namespace */ - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { - EX_T(opline->result.u.var).tmp_var = c->value; - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); - ZEND_VM_NEXT_OPCODE(); - } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { - if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { - zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); - } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - Z_STRVAL(opline->op2.u.constant), - Z_STRVAL(opline->op2.u.constant)); - EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + /* try a constant in class */ + ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); + if (!ce) { + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); } - ZEND_VM_NEXT_OPCODE(); - } - /* no constant found. try a constant in class */ - ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); - if (!ce) { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } } else { @@ -17910,6 +18095,27 @@ EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { + if (IS_UNUSED == IS_CONST) { + zend_op *op_data = opline + 1; + zend_constant *c; + /* no constant found. try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); } @@ -17917,6 +18123,50 @@ } } +static int ZEND_FASTCALL ZEND_FETCH_NS_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + + if (IS_UNUSED == IS_UNUSED) { + if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL(opline->op2.u.constant)); + } + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } else { + zend_op *op_data = opline + 1; + zend_constant *c; + + ZEND_VM_INC_OPCODE(); + + /* try a constant in namespace */ + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(op_data->op1.u.constant), Z_STRLEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &c)==SUCCESS) { + EX_T(opline->result.u.var).tmp_var = c->value; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + ZEND_VM_NEXT_OPCODE(); + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) { + if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) { + zend_error_noreturn(E_ERROR, "Undefined constant '%s::%s'", Z_STRVAL(opline->op1.u.constant), Z_STRVAL(opline->op2.u.constant)); + } else if (!zend_get_constant(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) { + zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", + Z_STRVAL(opline->op2.u.constant), + Z_STRVAL(opline->op2.u.constant)); + EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant; + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); + } + ZEND_VM_NEXT_OPCODE(); + } + } + + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -34096,6 +34346,56 @@ ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_INIT_NS_FUNCTION_CALL_SPEC_CONST_CONST_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_FETCH_NS_CONSTANT_SPEC_CONST_CONST_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_FETCH_NS_CONSTANT_SPEC_UNUSED_CONST_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, + ZEND_NULL_HANDLER, ZEND_NULL_HANDLER }; zend_opcode_handlers = (opcode_handler_t*)labels; Index: Zend/zend_vm_opcodes.h =================================================================== RCS file: /repository/ZendEngine2/zend_vm_opcodes.h,v retrieving revision 1.42.2.17.2.1.2.7 diff -u -u -r1.42.2.17.2.1.2.7 zend_vm_opcodes.h --- Zend/zend_vm_opcodes.h 14 Jul 2008 09:49:02 -0000 1.42.2.17.2.1.2.7 +++ Zend/zend_vm_opcodes.h 12 Sep 2008 03:08:17 -0000 @@ -153,3 +153,5 @@ #define ZEND_USER_OPCODE 150 #define ZEND_JMP_SET 152 #define ZEND_DECLARE_LAMBDA_FUNCTION 153 +#define ZEND_INIT_NS_FUNCTION_CALL 154 +#define ZEND_FETCH_NS_CONSTANT 155 Index: Zend/tests/ns_071.inc =================================================================== RCS file: Zend/tests/ns_071.inc diff -N Zend/tests/ns_071.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Zend/tests/ns_071.inc 12 Sep 2008 03:08:27 -0000 @@ -0,0 +1,12 @@ + +===DONE=== +--EXPECT-- +namespace function two +namespace function +static method +won +namespace function +namespace function +namespace function +static method +one +two +===DONE=== --------------030602080601070103090504--