Re: Hash problems in session-oo code
| From: | Arpad Ray | Date: | Fri, 11 Nov 2011 14:45:32 +0000 |
| Subject: | Re: Hash problems in session-oo code | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56278@lists.php.net to get a copy of this message | ||
On Fri, Nov 11, 2011 at 12:17 AM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> Hey Arpad, looking through the code you added to
> ext/standard/basic_functions.c it looks like you are doing some weird
> key handling in the shutdown function hash.
>
>
Hi Rasmus,
Thanks for the heads up, just fixed these.
Cheers,
Arpad
> In register_user_shutdown_function() you have:
>
> zend_hash_update(BG(user_shutdown_function_names), function_name,
> sizeof(function_name), shutdown_function_entry,
> sizeof(php_shutdown_function_entry), NULL)
>
> And in remove_user_shutdown_function() you have:
>
> zend_hash_del_key_or_index(BG(user_shutdown_function_names),
> function_name, sizeof(function_name), 0, HASH_DEL_KEY)
>
> In both cases function_name is a char* so sizeof(function_name) is
> always going to be the size of a char* on whatever architecture you are
> on. But the way hash keys work, it is the actual string that is the key
> and you should be passing the length of that string here.
>
> -Rasmus
>