diff -up php-5.2.17/ext/standard/var.c.bug-55082 php-5.2.17/ext/standard/var.c --- php-5.2.17/ext/standard/var.c.bug-55082 2010-09-14 03:14:18.000000000 +0700 +++ php-5.2.17/ext/standard/var.c 2011-08-28 15:18:52.000000000 +0700 @@ -401,7 +401,7 @@ static int php_object_element_export(zva { int level; smart_str *buf; - char *prop_name, *class_name; + TSRMLS_FETCH(); level = va_arg(args, int); @@ -409,11 +409,20 @@ static int php_object_element_export(zva buffer_append_spaces(buf, level + 2); if (hash_key->nKeyLength != 0) { - zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); + char *class_name, /* ignored, but must be passed to unmangle */ + *pname, + *pname_esc; + int pname_esc_len; + + zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, + &class_name, &pname); + pname_esc = php_addcslashes(pname, strlen(pname), &pname_esc_len, 0, + "'\\", 2 TSRMLS_CC); smart_str_appendc(buf, '\''); - smart_str_appends(buf, prop_name); + smart_str_appendl(buf, pname_esc, pname_esc_len); smart_str_appendc(buf, '\''); + efree(pname_esc); } else { smart_str_append_long(buf, hash_key->h); }