diff options
| author | Scott MacVicar <scottmac@php.net> | 2009-06-19 03:29:47 +0000 |
|---|---|---|
| committer | Scott MacVicar <scottmac@php.net> | 2009-06-19 03:29:47 +0000 |
| commit | d976be4bda9c3af7000b1ee7af0e2026bef7a0a4 (patch) | |
| tree | b8b3470a6fbd11999ecbd5b64e37904f5ffee50b /Zend/zend_object_handlers.c | |
| parent | e64f0795e10eb77784c89b6942b9e5bbf4db094d (diff) | |
| download | php-git-d976be4bda9c3af7000b1ee7af0e2026bef7a0a4.tar.gz | |
Make the check case sensitive, and since we can only have a constructor that matches the class name or is __construct
its probably safe to just check for __. This means we can skip lowering the function_name, which is hard to be binary
safe sine we don't store the length.
If we just did a zend_hash_exists lookup we'd be fine since its stored lowercased already :)
Diffstat (limited to 'Zend/zend_object_handlers.c')
| -rw-r--r-- | Zend/zend_object_handlers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 6848977ae3..59a4260ff2 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -942,8 +942,10 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f if (function_name_strlen == ce->name_length && ce->constructor) { lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length); - /* Only change the method to the constructor if a __construct() method doesn't exist */ - if (!memcmp(lc_class_name, function_name_strval, function_name_strlen) && memcmp(ce->constructor->common.function_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) { + /* Only change the method to the constructor if the constructor isn't called __construct + * we check for __ so we can be binary safe for lowering, we should use ZEND_CONSTRUCTOR_FUNC_NAME + */ + if (!memcmp(lc_class_name, function_name_strval, function_name_strlen) && memcmp(ce->constructor->common.function_name, "__", sizeof("__") - 1)) { fbc = ce->constructor; } efree(lc_class_name); |
