com php-src: Merge branch 'PHP-5.5' into PHP-5.6: NEWS Zend/zend_compile.c Zend/zend_compile.h Zend/zend _language_parser.y
| From: | Nikita Popov | Date: | Mon, 06 Apr 2015 20:06:48 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.5' into PHP-5.6: NEWS Zend/zend_compile.c Zend/zend_compile.h Zend/zend _language_parser.y | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86111@lists.php.net to get a copy of this message | ||
Commit: 7e9a1c1e3fb391eb06c2d7f46bfa38c97a6d72a1
Author: Nikita Popov <nikic@php.net> Mon, 6 Apr 2015 22:06:48 +0200
Parents: d819b45597cc2945329cef0fcead832e25dd61f1 cc70a46525f72340061107ced390eba3be1bf12a
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7e9a1c1e3fb391eb06c2d7f46bfa38c97a6d72a1
Log:
Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
Zend/zend_compile.c
Zend/zend_compile.h
Changed paths:
MM NEWS
MM Zend/zend_compile.c
MM Zend/zend_compile.h
MM Zend/zend_language_parser.y
diff --cc NEWS index 793dbae,53b8776..bacfa36 --- a/NEWS +++ b/NEWS @@@ -1,10 -1,18 +1,12 @@@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 2015, PHP 5.5.25 +?? May 2015, PHP 5.6.9 - Core: + . Fixed bug #60022 ("use statement [...] has no effect" depends on leading + backslash). (Nikita) . Fixed bug #68652 (segmentation fault in destructor). (Dmitry) -- cURL: - . Fixed bug #68739 (Missing break / control flow). (Laruence) - -- Ereg: - . Fixed bug #68740 (NULL Pointer Dereference). (Laruence) - - ODBC: . Fixed bug #69354 (Incorrect use of SQLColAttributes with ODBC 3.0). (Anatol) diff --cc Zend/zend_compile.c index 180bcd1,94566a5..96bf12d --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -7167,8 -7040,9 +7167,8 @@@ void zend_do_use(znode *ns_name, znode if (p) { ZVAL_STRING(name, p+1, 1); } else { - *name = *ns; - zval_copy_ctor(name); + ZVAL_ZVAL(name, ns, 1, 0); - warn = !is_global && !CG(current_namespace); + warn = !CG(current_namespace); } } @@@ -7224,120 -7098,16 +7224,120 @@@ } /* }}} */ - void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */ -void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ ++void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */ { - zend_op *opline; + char *lookup_name; + zval *name, *ns, tmp; + zend_bool warn = 0; - if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) { - zend_error(E_COMPILE_ERROR, "Arrays are not allowed as constants"); + MAKE_STD_ZVAL(ns); + ZVAL_ZVAL(ns, &ns_name->u.constant, 0, 0); + if (new_name) { + name = &new_name->u.constant; + } else { + const char *p; + + /* The form "use A\B" is eqivalent to "use A\B as B". + So we extract the last part of compound name to use as a new_name */ + name = &tmp; + p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns)); + if (p) { + ZVAL_STRING(name, p+1, 1); + } else { + ZVAL_ZVAL(name, ns, 1, 0); - warn = !is_global && !CG(current_namespace); ++ warn = !CG(current_namespace); + } } + if (case_sensitive) { + lookup_name = estrndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + } else { + lookup_name = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + } + + if (CG(current_namespace)) { + /* Prefix import name with current namespace name to avoid conflicts with functions/consts */ + char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1); + + zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); + c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\'; + memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lookup_name, Z_STRLEN_P(name)+1); + if (zend_hash_exists(lookup_table, c_ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) { + char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || + memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(tmp2); + } + efree(c_ns_name); + } else if (is_function) { + zend_function *function; + + if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &function) == SUCCESS && function->type == ZEND_USER_FUNCTION && strcmp(function->op_array.filename, CG(compiled_filename)) == 0) { + char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lookup_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use function %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(c_tmp); + } + } else { + const char *filename; + + if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &filename) == SUCCESS && strcmp(filename, CG(compiled_filename)) == 0) { + char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lookup_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use const %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(c_tmp); + } + } + + if (zend_hash_add(current_import_sub, lookup_name, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { + zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + if (warn) { + zend_error(E_WARNING, "The use %s statement with non-compound name '%s' has no effect", is_function ? "function" : "const", Z_STRVAL_P(name)); + } + efree(lookup_name); + zval_dtor(name); +} +/* }}} */ + - void zend_do_use_function(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */ ++void zend_do_use_function(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */ +{ + if (!CG(current_import_function)) { + CG(current_import_function) = emalloc(sizeof(HashTable)); + zend_hash_init(CG(current_import_function), 0, NULL, ZVAL_PTR_DTOR, 0); + } + - zend_do_use_non_class(ns_name, new_name, is_global, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC); ++ zend_do_use_non_class(ns_name, new_name, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC); +} +/* }}} */ + - void zend_do_use_const(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */ ++void zend_do_use_const(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */ +{ + if (!CG(current_import_const)) { + CG(current_import_const) = emalloc(sizeof(HashTable)); + zend_hash_init(CG(current_import_const), 0, NULL, ZVAL_PTR_DTOR, 0); + } + - zend_do_use_non_class(ns_name, new_name, is_global, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC); ++ zend_do_use_non_class(ns_name, new_name, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC); +} +/* }}} */ + +void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ +{ + zend_op *opline; + zval **ns_name; + if (zend_get_ct_const(&name->u.constant, 0 TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); } if (CG(current_namespace)) { diff --cc Zend/zend_compile.h index 3e9992f,2d88334..921d389 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@@ -651,12 -635,8 +651,12 @@@ void zend_do_build_namespace_name(znod void zend_do_begin_namespace(const znode *name, zend_bool with_brackets TSRMLS_DC); void zend_do_end_namespace(TSRMLS_D); void zend_verify_namespace(TSRMLS_D); - void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC); - void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC); - void zend_do_use_function(znode *name, znode *new_name, int is_global TSRMLS_DC); - void zend_do_use_const(znode *name, znode *new_name, int is_global TSRMLS_DC); + void zend_do_use(znode *name, znode *new_name TSRMLS_DC); ++void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC); ++void zend_do_use_function(znode *name, znode *new_name TSRMLS_DC); ++void zend_do_use_const(znode *name, znode *new_name TSRMLS_DC); void zend_do_end_compilation(TSRMLS_D); +void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC); void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static TSRMLS_DC); diff --cc Zend/zend_language_parser.y index 192589e,2926c8c..67f1a71 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@@ -255,36 -249,12 +255,36 @@@ use_declarations ; use_declaration: - namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); } - | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); } + namespace_name { zend_do_use(&$1, NULL TSRMLS_CC); } + | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4 TSRMLS_CC); } ; +use_function_declarations: + use_function_declarations ',' use_function_declaration + | use_function_declaration +; + +use_function_declaration: - namespace_name { zend_do_use_function(&$1, NULL, 0 TSRMLS_CC); } - | namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL, 1 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4, 1 TSRMLS_CC); } ++ namespace_name { zend_do_use_function(&$1, NULL TSRMLS_CC); } ++ | namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3 TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4 TSRMLS_CC); } +; + +use_const_declarations: + use_const_declarations ',' use_const_declaration + | use_const_declaration +; + +use_const_declaration: - namespace_name { zend_do_use_const(&$1, NULL, 0 TSRMLS_CC); } - | namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL, 1 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4, 1 TSRMLS_CC); } ++ namespace_name { zend_do_use_const(&$1, NULL TSRMLS_CC); } ++ | namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3 TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4 TSRMLS_CC); } +; + constant_declaration: constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_constant(&$3, &$5 TSRMLS_CC); } | T_CONST T_STRING '=' static_scalar { zend_do_declare_constant(&$2, &$4 TSRMLS_CC); }
diff --cc NEWS index 793dbae,53b8776..bacfa36 --- a/NEWS +++ b/NEWS @@@ -1,10 -1,18 +1,12 @@@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 2015, PHP 5.5.25 +?? May 2015, PHP 5.6.9 - Core: + . Fixed bug #60022 ("use statement [...] has no effect" depends on leading + backslash). (Nikita) . Fixed bug #68652 (segmentation fault in destructor). (Dmitry) -- cURL: - . Fixed bug #68739 (Missing break / control flow). (Laruence) - -- Ereg: - . Fixed bug #68740 (NULL Pointer Dereference). (Laruence) - - ODBC: . Fixed bug #69354 (Incorrect use of SQLColAttributes with ODBC 3.0). (Anatol) diff --cc Zend/zend_compile.c index 180bcd1,94566a5..96bf12d --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -7167,8 -7040,9 +7167,8 @@@ void zend_do_use(znode *ns_name, znode if (p) { ZVAL_STRING(name, p+1, 1); } else { - *name = *ns; - zval_copy_ctor(name); + ZVAL_ZVAL(name, ns, 1, 0); - warn = !is_global && !CG(current_namespace); + warn = !CG(current_namespace); } } @@@ -7224,120 -7098,16 +7224,120 @@@ } /* }}} */ - void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */ -void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ ++void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */ { - zend_op *opline; + char *lookup_name; + zval *name, *ns, tmp; + zend_bool warn = 0; - if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) { - zend_error(E_COMPILE_ERROR, "Arrays are not allowed as constants"); + MAKE_STD_ZVAL(ns); + ZVAL_ZVAL(ns, &ns_name->u.constant, 0, 0); + if (new_name) { + name = &new_name->u.constant; + } else { + const char *p; + + /* The form "use A\B" is eqivalent to "use A\B as B". + So we extract the last part of compound name to use as a new_name */ + name = &tmp; + p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns)); + if (p) { + ZVAL_STRING(name, p+1, 1); + } else { + ZVAL_ZVAL(name, ns, 1, 0); - warn = !is_global && !CG(current_namespace); ++ warn = !CG(current_namespace); + } } + if (case_sensitive) { + lookup_name = estrndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + } else { + lookup_name = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + } + + if (CG(current_namespace)) { + /* Prefix import name with current namespace name to avoid conflicts with functions/consts */ + char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1); + + zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); + c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\'; + memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lookup_name, Z_STRLEN_P(name)+1); + if (zend_hash_exists(lookup_table, c_ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) { + char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || + memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(tmp2); + } + efree(c_ns_name); + } else if (is_function) { + zend_function *function; + + if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &function) == SUCCESS && function->type == ZEND_USER_FUNCTION && strcmp(function->op_array.filename, CG(compiled_filename)) == 0) { + char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lookup_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use function %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(c_tmp); + } + } else { + const char *filename; + + if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &filename) == SUCCESS && strcmp(filename, CG(compiled_filename)) == 0) { + char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + + if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lookup_name, Z_STRLEN_P(ns))) { + zend_error(E_COMPILE_ERROR, "Cannot use const %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + efree(c_tmp); + } + } + + if (zend_hash_add(current_import_sub, lookup_name, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { + zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL_P(ns), Z_STRVAL_P(name)); + } + if (warn) { + zend_error(E_WARNING, "The use %s statement with non-compound name '%s' has no effect", is_function ? "function" : "const", Z_STRVAL_P(name)); + } + efree(lookup_name); + zval_dtor(name); +} +/* }}} */ + - void zend_do_use_function(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */ ++void zend_do_use_function(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */ +{ + if (!CG(current_import_function)) { + CG(current_import_function) = emalloc(sizeof(HashTable)); + zend_hash_init(CG(current_import_function), 0, NULL, ZVAL_PTR_DTOR, 0); + } + - zend_do_use_non_class(ns_name, new_name, is_global, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC); ++ zend_do_use_non_class(ns_name, new_name, 1, 0, CG(current_import_function), CG(function_table) TSRMLS_CC); +} +/* }}} */ + - void zend_do_use_const(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */ ++void zend_do_use_const(znode *ns_name, znode *new_name TSRMLS_DC) /* {{{ */ +{ + if (!CG(current_import_const)) { + CG(current_import_const) = emalloc(sizeof(HashTable)); + zend_hash_init(CG(current_import_const), 0, NULL, ZVAL_PTR_DTOR, 0); + } + - zend_do_use_non_class(ns_name, new_name, is_global, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC); ++ zend_do_use_non_class(ns_name, new_name, 0, 1, CG(current_import_const), &CG(const_filenames) TSRMLS_CC); +} +/* }}} */ + +void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ +{ + zend_op *opline; + zval **ns_name; + if (zend_get_ct_const(&name->u.constant, 0 TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant)); } if (CG(current_namespace)) { diff --cc Zend/zend_compile.h index 3e9992f,2d88334..921d389 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@@ -651,12 -635,8 +651,12 @@@ void zend_do_build_namespace_name(znod void zend_do_begin_namespace(const znode *name, zend_bool with_brackets TSRMLS_DC); void zend_do_end_namespace(TSRMLS_D); void zend_verify_namespace(TSRMLS_D); - void zend_do_use(znode *name, znode *new_name, int is_global TSRMLS_DC); - void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC); - void zend_do_use_function(znode *name, znode *new_name, int is_global TSRMLS_DC); - void zend_do_use_const(znode *name, znode *new_name, int is_global TSRMLS_DC); + void zend_do_use(znode *name, znode *new_name TSRMLS_DC); ++void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC); ++void zend_do_use_function(znode *name, znode *new_name TSRMLS_DC); ++void zend_do_use_const(znode *name, znode *new_name TSRMLS_DC); void zend_do_end_compilation(TSRMLS_D); +void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC); void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static TSRMLS_DC); diff --cc Zend/zend_language_parser.y index 192589e,2926c8c..67f1a71 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@@ -255,36 -249,12 +255,36 @@@ use_declarations ; use_declaration: - namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); } - | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL, 1 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); } + namespace_name { zend_do_use(&$1, NULL TSRMLS_CC); } + | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4 TSRMLS_CC); } ; +use_function_declarations: + use_function_declarations ',' use_function_declaration + | use_function_declaration +; + +use_function_declaration: - namespace_name { zend_do_use_function(&$1, NULL, 0 TSRMLS_CC); } - | namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL, 1 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4, 1 TSRMLS_CC); } ++ namespace_name { zend_do_use_function(&$1, NULL TSRMLS_CC); } ++ | namespace_name T_AS T_STRING { zend_do_use_function(&$1, &$3 TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4 TSRMLS_CC); } +; + +use_const_declarations: + use_const_declarations ',' use_const_declaration + | use_const_declaration +; + +use_const_declaration: - namespace_name { zend_do_use_const(&$1, NULL, 0 TSRMLS_CC); } - | namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL, 1 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4, 1 TSRMLS_CC); } ++ namespace_name { zend_do_use_const(&$1, NULL TSRMLS_CC); } ++ | namespace_name T_AS T_STRING { zend_do_use_const(&$1, &$3 TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL TSRMLS_CC); } ++ | T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4 TSRMLS_CC); } +; + constant_declaration: constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_constant(&$3, &$5 TSRMLS_CC); } | T_CONST T_STRING '=' static_scalar { zend_do_declare_constant(&$2, &$4 TSRMLS_CC); }