Hello Brandon,

 that's by design. Look into: ext/spl/spl_functions.c:spl_register_sub_class()

regards
marcus

Tuesday, May 9, 2006, 6:58:43 AM, you wrote:

> I think I found a bug in the INIT_OVERLOADED_CLASS_ENTRY_EX macro. At
> least, I think its a bug, somebody else might think its a feature. :)

> If you do something like INIT_CLASS_ENTRY(ce, "MyClass", ...) everything
> works fine. However, if you have something like

> void register_class(char* name, ...)
> {
>    ...
>    INIT_CLASS_ENTRY(ce, name, ...);
>    ...
> }

> things don't work so well. When I run this through gdb and break right
> after the macro, ce.name = "MyClass" as expected. But ce.name_length = 3, 
> which is not quite right.

> It looks to me like the problem is in the 3rd line of the
> INIT_OVERLOADED_CLASS_ENTRY_EX macro...

> ---
> #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name,
> functions, handle_fcall, handle_propget, handle_propset, handle_propunset, 
> handle_propisset) \
>         {                                                                
>                 class_container.name = strdup(class_name);               
>                 class_container.name_length = sizeof(class_name) - 1;   \
> ---

> ...where sizeof() is used instead of strlen(). When class_name is a
> variable, sizeof() dutifully returns the size of the variable instead of
> the string length. Obviously this works, and provides a bit of a speed
> boost, when using literal strings, but it doesn't work so well for char*'s.

> Is this desired behavior or a bug?




Best regards,
 Marcus

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

Reply via email to