On Fri, 2003-03-07 at 14:24, Brad LaFountain wrote:
> Why can't you just simply name your classes all lowercase.

Because then I wouldn't have discovered the bug! =)

> All of the extensions currently do this and it works fine.

Apparently that is the case--that's probably why I had the pleasure of
discovering this bug myself.  Although we are not currently developing
this extension for public release, it may be open-sourced in the future,
and for that reason I have followed the CODING_STANDARDS document fairly
closely.

We could, of course, give all classes and functions lower case names,
but as I explained in my previous post, we are porting an existing
application that exists in C++ and Java and the developers of those
original versions chose to use CamelCaps.  AFAIC, the less changes
needed to the code, the better.

Personally, I'd rather have case-sensitive class and function names in
PHP, but the whole point is, if the Zend engine is going to try and look
them up them in lowercase, IMHO it'd be really nice if it'd store it the
same way :)

BTW, since my first post I have discovered the  README.SUBMITTING_PATCH
file.  I still don't have the time now to deal with CVS, though if
pushed I will do so, sometime in the future.  Nonetheless, I am
re-submitting the patch here as requested in the form of a MIME
attachment.  FWIW I also performed a "make test" with no FAILs, though I
did not create a new test case for this bug.

Let me know if there's anything else I can do to help.  If this patch
will not be accepted SOLEY due to the fact that it's not done on CVS,
please let me know and I will take care of that when I have time, and
resubmit it.

For now, I have spent enough time on this problem already.

Regards,
Eric

--- Zend/OLD_zend_API.c Wed Oct  9 07:17:52 2002
+++ Zend/zend_API.c     Fri Mar  7 14:49:36 2003
@@ -1039,6 +1039,12 @@
        internal_function->type = ZEND_INTERNAL_FUNCTION;
        
        while (ptr->fname) {
+               /* store all function names in lower case so they will always be found 
by
+                * call_user_function_ex() */
+               size_t fname_len = strlen(ptr->fname);
+               char *lowercase_name = zend_strndup(ptr->fname, fname_len);
+               zend_str_tolower(lowercase_name, fname_len);
+
                internal_function->handler = ptr->handler;
                internal_function->arg_types = ptr->func_arg_types;
                internal_function->function_name = ptr->fname;
@@ -1047,7 +1053,7 @@
                        zend_unregister_functions(functions, count, 
target_function_table TSRMLS_CC);
                        return FAILURE;
                }
-               if (zend_hash_add(target_function_table, ptr->fname, 
strlen(ptr->fname)+1, &function, sizeof(zend_function), NULL) == FAILURE) {
+               if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, 
&function, sizeof(zend_function), NULL) == FAILURE) {
                        unload=1;
                        break;
                }

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to