]> granicus.if.org Git - php/commitdiff
Use zend_unmangle_property_name_ex to save strlen
authorXinchen Hui <laruence@php.net>
Mon, 14 Jan 2013 09:08:21 +0000 (17:08 +0800)
committerXinchen Hui <laruence@php.net>
Mon, 14 Jan 2013 09:08:21 +0000 (17:08 +0800)
Zend/zend_compile.c
Zend/zend_object_handlers.c
ext/standard/http.c

index a5d6add5512a4c665e3942f0a35a4c2dbcc676e4..43b891695e0f45a73e38ada84b6c0f393791669e 100644 (file)
@@ -4221,9 +4221,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
                                prop_name_length = property_info->name_length;
                        } else {
                                /* for private and protected we need to unmangle the names */
-                               zend_unmangle_property_name(property_info->name, property_info->name_length,
-                                                                                       &class_name_unused, &prop_name);
-                               prop_name_length = strlen(prop_name);
+                               zend_unmangle_property_name_ex(property_info->name, property_info->name_length,
+                                                                                       &class_name_unused, &prop_name, &prop_name_length);
                                prop_hash = zend_get_hash_value(prop_name, prop_name_length + 1);
                        }
 
index 2c2a45d72676e17569bb61ee5c4a45bbf1f5fc5d..20d4e124c5bafd0d9aa8325c3b8fdef283b0b80a 100644 (file)
@@ -363,9 +363,10 @@ ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info
        zend_property_info *property_info;
        const char *class_name, *prop_name;
        zval member;
+       int prop_name_len;
 
-       zend_unmangle_property_name(prop_info_name, prop_info_name_len, &class_name, &prop_name);
-       ZVAL_STRING(&member, prop_name, 0);
+       zend_unmangle_property_name_ex(prop_info_name, prop_info_name_len, &class_name, &prop_name, &prop_name_len);
+       ZVAL_STRINGL(&member, prop_name, prop_name_len, 0);
        property_info = zend_get_property_info_quick(zobj->ce, &member, 1, NULL TSRMLS_CC);
        if (!property_info) {
                return FAILURE;
index 3e5073591e4ab9928bfc193a5134eeb6db08196a..547df52186959ec677de0201925de71565631e50 100644 (file)
@@ -69,12 +69,11 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
                        const char *tmp;
 
                        zend_object *zobj = zend_objects_get_address(type TSRMLS_CC);
-                       if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) != SUCCESS) {
+                       if (zend_check_property_access(zobj, key, key_len TSRMLS_CC) != SUCCESS) {
                                /* private or protected property access outside of the class */
                                continue;
                        }
-                       zend_unmangle_property_name(key, key_len-1, &tmp, (const char**)&key);
-                       key_len = strlen(key);          
+                       zend_unmangle_property_name_ex(key, key_len, &tmp, (const char**)&key, &key_len);
                }
 
                if (zend_hash_get_current_data_ex(ht, (void **)&zdata, NULL) == FAILURE || !zdata || !(*zdata)) {