Grr. Totally slipped my mind that with this patch, the original
function names will be lost when doing get_class_methods() and similar
stuff. Any other suggestions?
On Tue, 18 Mar 2003, Andrei Zmievski wrote:
> Currently when registering functions, the unmodified function name is
> used as the key for the function table. This leads to problems when an
> extension class has a constructor that is not all lowercased. For
> example:
>
> function_entry php_gtk_button_functions[] = {
> PHP_FE("GtkButton", NULL),
> ...
> };
>
> Then when using something like:
>
> ...
> parent::GtkButton();
> ...
>
> It fails because it uses 'gtkbutton' as the key to search the function
> table. The attached patch fixes that by lowercasing the key (function
> name) when registering functions.
>
> I know that some may say, "just use lowercase class name for the
> constructor in the function entry list", but that messes with nice
> class/function names again.
>
> -Andrei http://www.gravitonic.com/
> * It said 'Winmodem' on the box, but I still feel like I lost. *
> Index: zend_API.c
> ===================================================================
> RCS file: /repository/ZendEngine2/zend_API.c,v
> retrieving revision 1.158
> diff -u -2 -b -w -B -r1.158 zend_API.c
> --- zend_API.c 13 Mar 2003 20:41:58 -0000 1.158
> +++ zend_API.c 18 Mar 2003 21:49:31 -0000
> @@ -1147,4 +1147,6 @@
> int error_type;
> zend_function *ctor = NULL, *dtor = NULL, *clone = NULL;
> + char *lowercase_name;
> + int fname_len;
>
> if (type==MODULE_PERSISTENT) {
> @@ -1171,6 +1174,10 @@
> return FAILURE;
> }
> - if (zend_hash_add(target_function_table, ptr->fname,
> strlen(ptr->fname)+1, &function, sizeof(zend_function), (void**)®_function) ==
> FAILURE) {
> + fname_len = strlen(ptr->fname);
> + lowercase_name = zend_strndup(ptr->fname, fname_len);
> + zend_str_tolower(lowercase_name, fname_len);
> + if (zend_hash_add(target_function_table, lowercase_name, fname_len+1,
> &function, sizeof(zend_function), (void**)®_function) == FAILURE) {
> unload=1;
> + free(lowercase_name);
> break;
> }
> @@ -1192,4 +1199,5 @@
> ptr++;
> count++;
> + free(lowercase_name);
> }
> if (unload) { /* before unloading, display all remaining bad function in the
> module */
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
-Andrei http://www.gravitonic.com/
* "UNIX, isn't that some archaic form of DOS?" - our job applicant *
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php