summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harvey <aharvey@php.net>2013-11-08 21:29:23 -0500
committerAdam Harvey <aharvey@php.net>2013-11-08 21:29:23 -0500
commit1ea01f55dbfbefd3b351f05c405e85ac778cdee7 (patch)
tree21b297ff16ad337b01847a3fef91adb5c691bc27
parent9711c58bc4236c0e2e482af9b20581e78af0c7ca (diff)
downloadphp-git-1ea01f55dbfbefd3b351f05c405e85ac778cdee7.tar.gz
Look in the function_table instead of function_filenames for actually declared
functions.
-rw-r--r--Zend/zend_compile.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 0313663735..228fe6f87d 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -7163,7 +7163,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, const char *type, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */
{
char *lookup_name;
- char *filename;
+ zend_function *function = NULL;
zval *name, *ns, tmp;
zend_bool warn = 0;
@@ -7210,14 +7210,16 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, const
efree(tmp2);
}
efree(c_ns_name);
- } else 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));
+ } else {
+ if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &function) == SUCCESS && 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 %s %s as %s because the name is already in use", type, Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ 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 %s %s as %s because the name is already in use", type, Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ }
+ efree(c_tmp);
}
- efree(c_tmp);
}
if (zend_hash_add(current_import_sub, lookup_name, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) {
@@ -7238,7 +7240,7 @@ void zend_do_use_function(znode *ns_name, znode *new_name, int is_global TSRMLS_
zend_hash_init(CG(current_import_function), 0, NULL, ZVAL_PTR_DTOR, 0);
}
- zend_do_use_non_class(ns_name, new_name, is_global, "function", 0, CG(current_import_function), &CG(function_filenames) TSRMLS_CC);
+ zend_do_use_non_class(ns_name, new_name, is_global, "function", 0, CG(current_import_function), CG(function_table) TSRMLS_CC);
}
/* }}} */