Hello Antony,
i am pretty sure we do not need a _ex version here but can instead move
the modification in the one implementation of the unmangle function.
Friday, September 16, 2005, 7:05:15 PM, you wrote:
> http://cvs.php.net/diff.php/ZendEngine2/zend.c?r1=1.308.2.1&r2=1.308.2.2&ty=u
> Index: ZendEngine2/zend.c
> diff -u ZendEngine2/zend.c:1.308.2.1 ZendEngine2/zend.c:1.308.2.2
> --- ZendEngine2/zend.c:1.308.2.1 Mon Sep 12 05:06:15 2005
> +++ ZendEngine2/zend.c Fri Sep 16 13:05:06 2005
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend.c,v 1.308.2.1 2005/09/12 09:06:15 dmitry Exp $ */
> +/* $Id: zend.c,v 1.308.2.2 2005/09/16 17:05:06 tony2001 Exp $ */
>
> #include "zend.h"
> #include "zend_extensions.h"
> @@ -129,7 +129,7 @@
> if (is_object) {
> char *prop_name, *class_name;
>
> -
> zend_unmangle_property_name(string_key, &class_name, &prop_name);
> +
> zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name);
> ZEND_PUTS(prop_name);
> if (class_name) {
> if (class_name[0]=='*') {
> http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.4&r2=1.277.2.5&ty=u
> Index: ZendEngine2/zend_builtin_functions.c
> diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.4
> ZendEngine2/zend_builtin_functions.c:1.277.2.5
> --- ZendEngine2/zend_builtin_functions.c:1.277.2.4 Fri Sep 9 02:48:47
> 2005
> +++ ZendEngine2/zend_builtin_functions.c Fri Sep 16 13:05:06 2005
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_builtin_functions.c,v 1.277.2.4 2005/09/09 06:48:47 dmitry Exp
> $ */
> +/* $Id: zend_builtin_functions.c,v 1.277.2.5 2005/09/16 17:05:06 tony2001
> Exp $ */
>
> #include "zend.h"
> #include "zend_API.h"
> @@ -690,7 +690,7 @@
>
> zend_hash_get_current_key_ex(properties, &key,
> &key_len, &num_index, 0, &pos);
> zend_hash_move_forward_ex(properties, &pos);
> - zend_unmangle_property_name(key, &class_name,
> &prop_name);
> + zend_unmangle_property_name_ex(key, key_len,
> &class_name, &prop_name);
> if (class_name) {
> if (class_name[0] != '*' &&
> strcmp(class_name, ce->name)) {
> /* filter privates from base classes
> */
> @@ -782,7 +782,7 @@
> (*value)->refcount++;
> add_assoc_zval_ex(return_value, key, key_len,
> *value);
> } else if (instanceof) {
> - zend_unmangle_property_name(key, &class_name,
> &prop_name);
> + zend_unmangle_property_name_ex(key, key_len,
> &class_name, &prop_name);
> if (!memcmp(class_name, "*", 2) ||
> (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) &&
> !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) {
> /* Not separating references */
> (*value)->refcount++;
> @@ -931,7 +931,7 @@
> if (property_info->flags & ZEND_ACC_PUBLIC) {
> RETURN_TRUE;
> }
> - zend_unmangle_property_name(property_info->name, &class_name,
> &prop_name);
> + zend_unmangle_property_name_ex(property_info->name,
> property_info->name_length, &class_name, &prop_name);
> if (!strncmp(class_name, "*", 1)) {
> if (instanceof_function(EG(scope), ce TSRMLS_CC)) {
> RETURN_TRUE;
> http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.647.2.5&r2=1.647.2.6&ty=u
> Index: ZendEngine2/zend_compile.c
> diff -u ZendEngine2/zend_compile.c:1.647.2.5
> ZendEngine2/zend_compile.c:1.647.2.6
> --- ZendEngine2/zend_compile.c:1.647.2.5 Fri Sep 16 09:42:49 2005
> +++ ZendEngine2/zend_compile.c Fri Sep 16 13:05:07 2005
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_compile.c,v 1.647.2.5 2005/09/16 13:42:49 dmitry Exp $ */
> +/* $Id: zend_compile.c,v 1.647.2.6 2005/09/16 17:05:07 tony2001 Exp $ */
>
> #include <zend_language_parser.h>
> #include "zend.h"
> @@ -2065,7 +2065,7 @@
> if
> (zend_hash_find(&ce->default_static_members, child_info->name,
> child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
> if (Z_TYPE_PP(new_prop)
> != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) {
> char *prop_name, *tmp;
> -
> zend_unmangle_property_name(child_info->name, &tmp, &prop_name);
> +
> zend_unmangle_property_name_ex(child_info->name, child_info->name_length,
> &tmp, &prop_name);
>
>
> zend_error(E_COMPILE_ERROR, "Cannot change initial value of property
> static protected %s::$%s in class %s",
>
> parent_ce->name, prop_name, ce->name);
> @@ -2814,6 +2814,18 @@
> }
>
>
> +ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int
> mangled_property_len, char **class_name, char **prop_name)
> +{
> + *prop_name = *class_name = NULL;
> +
> + if (mangled_property_len < 2) { /* do not try to unmangle empty
> strings */
> + *prop_name = mangled_property;
> + return;
> + }
> +
> + zend_unmangle_property_name(mangled_property, class_name, prop_name);
> +}
> +
> ZEND_API void zend_unmangle_property_name(char *mangled_property, char
> **class_name, char **prop_name)
> {
> *prop_name = *class_name = NULL;
> http://cvs.php.net/diff.php/ZendEngine2/zend_compile.h?r1=1.316.2.2&r2=1.316.2.3&ty=u
> Index: ZendEngine2/zend_compile.h
> diff -u ZendEngine2/zend_compile.h:1.316.2.2
> ZendEngine2/zend_compile.h:1.316.2.3
> --- ZendEngine2/zend_compile.h:1.316.2.2 Fri Sep 9 02:48:48 2005
> +++ ZendEngine2/zend_compile.h Fri Sep 16 13:05:08 2005
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_compile.h,v 1.316.2.2 2005/09/09 06:48:48 dmitry Exp $ */
> +/* $Id: zend_compile.h,v 1.316.2.3 2005/09/16 17:05:08 tony2001 Exp $ */
>
> #ifndef ZEND_COMPILE_H
> #define ZEND_COMPILE_H
> @@ -522,6 +522,7 @@
>
> ZEND_API void zend_mangle_property_name(char **dest, int *dest_length,
> char *src1, int src1_length, char *src2, int src2_length, int internal);
> ZEND_API void zend_unmangle_property_name(char *mangled_property, char
> **prop_name, char **class_name);
> +ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int
> mangled_property_len, char **prop_name, char **class_name);
>
> #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
> #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
> http://cvs.php.net/diff.php/ZendEngine2/zend_reflection_api.c?r1=1.164.2.4&r2=1.164.2.5&ty=u
> Index: ZendEngine2/zend_reflection_api.c
> diff -u ZendEngine2/zend_reflection_api.c:1.164.2.4
> ZendEngine2/zend_reflection_api.c:1.164.2.5
> --- ZendEngine2/zend_reflection_api.c:1.164.2.4 Thu Sep 1 06:05:32 2005
> +++ ZendEngine2/zend_reflection_api.c Fri Sep 16 13:05:08 2005
> @@ -19,7 +19,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_reflection_api.c,v 1.164.2.4 2005/09/01 10:05:32 dmitry Exp $ */
> +/* $Id: zend_reflection_api.c,v 1.164.2.5 2005/09/16 17:05:08 tony2001 Exp $
> */
> #include "zend.h"
> #include "zend_API.h"
> #include "zend_exceptions.h"
> @@ -720,7 +720,7 @@
> string_printf(str, "static ");
> }
>
> - zend_unmangle_property_name(prop->name, &class_name,
> &prop_name);
> + zend_unmangle_property_name_ex(prop->name,
> prop->name_length, &class_name, &prop_name);
> string_printf(str, "$%s", prop_name);
> }
>
> @@ -978,7 +978,7 @@
> property_reference *reference;
> char *class_name, *prop_name;
>
> - zend_unmangle_property_name(prop->name, &class_name, &prop_name);
> + zend_unmangle_property_name_ex(prop->name, prop->name_length,
> &class_name, &prop_name);
>
> if (!(prop->flags & ZEND_ACC_PRIVATE)) {
> /* we have to seach the class hierarchy for this
> (implicit) public or protected property */
> @@ -2457,7 +2457,7 @@
>
>
> zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len,
> &num_index, 0, &pos);
>
> zend_hash_move_forward_ex(&ce->default_properties, &pos);
> - zend_unmangle_property_name(key, &class_name,
> &prop_name);
> + zend_unmangle_property_name_ex(key, key_len,
> &class_name, &prop_name);
> if (class_name && class_name[0] != '*' &&
> strcmp(class_name, ce->name)) {
> /* filter privates from base classes */
> continue;
> @@ -3311,7 +3311,7 @@
> ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
> zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"),
> (void **) &classname, sizeof(zval *), NULL);
>
> - zend_unmangle_property_name(property_info->name, &class_name,
> &prop_name);
> + zend_unmangle_property_name_ex(property_info->name,
> property_info->name_length, &class_name, &prop_name);
> MAKE_STD_ZVAL(propname);
> ZVAL_STRING(propname, prop_name, 1);
> zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"),
> (void **) &propname, sizeof(zval *), NULL);
> http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.59.2.6&r2=1.59.2.7&ty=u
> Index: ZendEngine2/zend_vm_def.h
> diff -u ZendEngine2/zend_vm_def.h:1.59.2.6 ZendEngine2/zend_vm_def.h:1.59.2.7
> --- ZendEngine2/zend_vm_def.h:1.59.2.6 Fri Sep 16 10:42:41 2005
> +++ ZendEngine2/zend_vm_def.h Fri Sep 16 13:05:09 2005
> @@ -16,7 +16,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_vm_def.h,v 1.59.2.6 2005/09/16 14:42:41 dmitry Exp $ */
> +/* $Id: zend_vm_def.h,v 1.59.2.7 2005/09/16 17:05:09 tony2001 Exp $ */
>
> /* If you change this file, please regenerate the zend_vm_execute.h and
> * zend_vm_opcodes.h files by running:
> @@ -3122,7 +3122,7 @@
> zend_hash_move_forward(fe_ht);
> } while (key_type != HASH_KEY_IS_STRING ||
> zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
> if (use_key) {
> - zend_unmangle_property_name(str_key,
> &class_name, &prop_name);
> + zend_unmangle_property_name_ex(str_key,
> str_key_len, &class_name, &prop_name);
> str_key_len = strlen(prop_name);
> str_key = estrndup(prop_name, str_key_len);
> str_key_len++;
> http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.62.2.6&r2=1.62.2.7&ty=u
> Index: ZendEngine2/zend_vm_execute.h
> diff -u ZendEngine2/zend_vm_execute.h:1.62.2.6
> ZendEngine2/zend_vm_execute.h:1.62.2.7
> --- ZendEngine2/zend_vm_execute.h:1.62.2.6 Fri Sep 16 10:42:42 2005
> +++ ZendEngine2/zend_vm_execute.h Fri Sep 16 13:05:09 2005
> @@ -16,7 +16,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_vm_execute.h,v 1.62.2.6 2005/09/16 14:42:42 dmitry Exp $ */
> +/* $Id: zend_vm_execute.h,v 1.62.2.7 2005/09/16 17:05:09 tony2001 Exp $ */
>
> static opcode_handler_t zend_user_opcode_handlers[256] =
> {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,
(opcode_handler_t)NULL,(opcode_ha!
>
> ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode
> andler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_h!
> andler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha
> ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_han
dler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha!
>
> ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NUL
> (opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_h!
> andler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha
> ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_han
dler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha!
>
> ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_hand
> r_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL};
>
> @@ -7598,7 +7598,7 @@
> zend_hash_move_forward(fe_ht);
> } while (key_type != HASH_KEY_IS_STRING ||
> zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
> if (use_key) {
> - zend_unmangle_property_name(str_key,
> &class_name, &prop_name);
> + zend_unmangle_property_name_ex(str_key,
> str_key_len, &class_name, &prop_name);
> str_key_len = strlen(prop_name);
> str_key = estrndup(prop_name, str_key_len);
> str_key_len++;
Best regards,
Marcus
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|