cvs: ZendEngine2 / zend_builtin_functions.c
| From: | Andrei Zmievski | Date: | Fri, 06 Oct 2006 17:05:23 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5315@lists.php.net to get a copy of this message | ||
andrei Fri Oct 6 17:05:23 2006 UTC
Modified files:
/ZendEngine2 zend_builtin_functions.c
Log:
Unicode string support in get_extension_funcs().
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.327&r2=1.328&diff_format=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.327 ZendEngine2/zend_builtin_functions.c:1.328
--- ZendEngine2/zend_builtin_functions.c:1.327 Tue Oct 3 16:28:02 2006
+++ ZendEngine2/zend_builtin_functions.c Fri Oct 6 17:05:22 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.327 2006/10/03 16:28:02 pollita Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.328 2006/10/06 17:05:22 andrei Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -2216,24 +2216,37 @@
/* }}} */
-/* {{{ proto array get_extension_funcs(string extension_name)
+/* {{{ proto array get_extension_funcs(string extension_name) U
Returns an array with the names of functions belonging to the named extension */
ZEND_FUNCTION(get_extension_funcs)
{
- zval **extension_name;
+ zstr ext;
+ int ext_len;
+ zend_uchar ext_type;
+ char *name;
zend_module_entry *module;
zend_function_entry *func;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &extension_name)) {
- ZEND_WRONG_PARAM_COUNT();
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &ext, &ext_len,
&ext_type) == FAILURE) {
+ return;
}
- /* UTODO: using runtime encoding? */
- convert_to_string_ex(extension_name);
- if (strncasecmp(Z_STRVAL_PP(extension_name), "zend", sizeof("zend"))) {
- char *lcname = zend_str_tolower_dup(Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name));
- if (zend_hash_find(&module_registry, lcname,
- Z_STRLEN_PP(extension_name)+1, (void**)&module) == FAILURE) {
+ if (ext_type == IS_UNICODE) {
+ name = zend_unicode_to_ascii(ext.u, ext_len TSRMLS_CC);
+ if (name == NULL) {
+ zend_error(E_WARNING, "Extension name has to consist only of ASCII characters");
+ RETURN_FALSE;
+ }
+ } else {
+ name = ext.s;
+ }
+
+ if (strncasecmp(name, "zend", sizeof("zend"))) {
+ char *lcname = zend_str_tolower_dup(name, ext_len);
+ if (ext_type == IS_UNICODE) {
+ efree(name);
+ }
+ if (zend_hash_find(&module_registry, lcname, ext_len+1, (void**)&module) == FAILURE) {
efree(lcname);
RETURN_FALSE;
}