diff options
author | Jani Taskinen <jani@php.net> | 2009-08-01 01:45:22 +0000 |
---|---|---|
committer | Jani Taskinen <jani@php.net> | 2009-08-01 01:45:22 +0000 |
commit | adf8f72f14707bf1096ac94f1b26133b039b2c84 (patch) | |
tree | 999439c4aec83305f706232d7ce970286309a84e /ext/reflection/php_reflection.c | |
parent | 0b03346bf8c43471584462328f3bb8e018448008 (diff) | |
download | php-git-adf8f72f14707bf1096ac94f1b26133b039b2c84.tar.gz |
- Fixed bug #49092 (ReflectionFunction fails to work with functions in fully qualified namespaces)
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 66d61c7370..8999c19994 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1516,8 +1516,18 @@ ZEND_METHOD(reflection_function, __construct) fptr = (zend_function*)zend_get_closure_method_def(closure TSRMLS_CC); Z_ADDREF_P(closure); } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == SUCCESS) { + char *nsname; + lcname = zend_str_tolower_dup(name_str, name_len); - if (zend_hash_find(EG(function_table), lcname, name_len + 1, (void **)&fptr) == FAILURE) { + + /* Ignore leading "\" */ + nsname = lcname; + if (lcname[0] == '\\') { + nsname = &lcname[1]; + name_len--; + } + + if (zend_hash_find(EG(function_table), nsname, name_len + 1, (void **)&fptr) == FAILURE) { efree(lcname); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Function %s() does not exist", name_str); |