For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > October 2006 > cvs: ZendEngine2 / zend_builtin_functions.c









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: ZendEngine2 / zend_builtin_functions.c
Andrei Zmievski

2006-10-06, 6:56 pm

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/ZendE...8&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(extensi
on_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;
}
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com