|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 201?, PHP 5.5.0 Alpha 3
+- Core:
+ . Fixed bug #63980 (object members get trimmed by zero bytes). (Laruence)
+
- General improvements:
. Fixed bug #63874 (Segfault if php_strip_whitespace has heredoc). (Pierrick)
. Fixed bug #63822 (Crash when using closures with ArrayAccess).
case HASH_KEY_IS_STRING:
if (is_object) {
const char *prop_name, *class_name;
- int mangled = zend_unmangle_property_name(string_key, str_len - 1, &class_name, &prop_name);
+ int prop_len;
+ int mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len);
- ZEND_PUTS_EX(prop_name);
+ ZEND_WRITE_EX(prop_name, prop_len);
if (class_name && mangled == SUCCESS) {
if (class_name[0]=='*') {
ZEND_PUTS_EX(":protected");
HashPosition pos;
char *key;
const char *prop_name, *class_name;
- uint key_len;
+ uint key_len, prop_len;
ulong num_index;
zend_object *zobj;
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) {
- zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
+ zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, &prop_len);
/* Not separating references */
Z_ADDREF_PP(value);
- add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value);
+ add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value);
}
}
zend_hash_move_forward_ex(properties, &pos);
}
/* }}} */
-ZEND_API int zend_unmangle_property_name(const char *mangled_property, int len, const char **class_name, const char **prop_name) /* {{{ */
+ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int len, const char **class_name, const char **prop_name, int *prop_len) /* {{{ */
{
int class_name_len;
if (mangled_property[0]!=0) {
*prop_name = mangled_property;
+ if (prop_len) {
+ *prop_len = len;
+ }
return SUCCESS;
}
if (len < 3 || mangled_property[1]==0) {
zend_error(E_NOTICE, "Illegal member variable name");
*prop_name = mangled_property;
+ if (prop_len) {
+ *prop_len = len;
+ }
return FAILURE;
}
- class_name_len = zend_strnlen(mangled_property+1, --len - 1) + 1;
+ class_name_len = zend_strnlen(mangled_property + 1, --len - 1) + 1;
if (class_name_len >= len || mangled_property[class_name_len]!=0) {
zend_error(E_NOTICE, "Corrupt member variable name");
*prop_name = mangled_property;
+ if (prop_len) {
+ *prop_len = len + 1;
+ }
return FAILURE;
}
- *class_name = mangled_property+1;
- *prop_name = (*class_name)+class_name_len;
+ *class_name = mangled_property + 1;
+ *prop_name = (*class_name) + class_name_len;
+ if (prop_len) {
+ *prop_len = len - class_name_len;
+ }
return SUCCESS;
}
/* }}} */
void zend_class_add_ref(zend_class_entry **ce);
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal);
-ZEND_API int zend_unmangle_property_name(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name);
+#define zend_unmangle_property_name(mangled_property, mangled_property_len, class_name, prop_name) \
+ zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL)
+ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len);
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS));
zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
if (use_key && key_type != HASH_KEY_IS_LONG) {
- zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name);
- str_key_len = strlen(prop_name);
+ zend_unmangle_property_name_ex(str_key, str_key_len-1, &class_name, &prop_name, &str_key_len);
str_key = estrndup(prop_name, str_key_len);
str_key_len++;
}
zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS));
zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
if (use_key && key_type != HASH_KEY_IS_LONG) {
- zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name);
- str_key_len = strlen(prop_name);
+ zend_unmangle_property_name_ex(str_key, str_key_len-1, &class_name, &prop_name, &str_key_len);
str_key = estrndup(prop_name, str_key_len);
str_key_len++;
}