Commit: 6b385ebc85ea8f01db726fbf06b82b4587fee332 Author: Danack <dan...@basereality.com> Thu, 22 Aug 2013 02:24:59 +0100 Committer: Igor Wiedler <i...@wiedler.ch> Thu, 22 Aug 2013 15:51:26 +0200 Parents: 2dbbb8ae4b8f20f68c4d9f0f708d4391bbf49d07 Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6b385ebc85ea8f01db726fbf06b82b4587fee332 Log: Removed assumption that \\ will be present The function zend_add_ns_func_name_literal is called if the parser finds a function that is not in the global or current namespace. It assumes such a function will have a \\ in it, which is no longer true with the use function patch. The code change above removes that assumption and makes the test work: PASS use and use function with the same alias [Zend/tests/use_function/conflicting_use_alias.phpt] Changed paths: M Zend/zend_compile.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 2660781..8725083 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -426,12 +426,16 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); - ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; - lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); - lc_name = zend_str_tolower_dup(ns_separator, lc_len); - ZVAL_STRINGL(&c, lc_name, lc_len, 0); - lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); - CALCULATE_LITERAL_HASH(lc_literal); + ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)); + + if (ns_separator != NULL) { + ns_separator += 1; + lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); + lc_name = zend_str_tolower_dup(ns_separator, lc_len); + ZVAL_STRINGL(&c, lc_name, lc_len, 0); + lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); + CALCULATE_LITERAL_HASH(lc_literal); + } return ret; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php