Skip to content
Browse files

Merged pull request #37

  • Loading branch information...
2 parents 9da6d93 + 0bbbe4b commit 49c99807648d868d626d6bf5af31fe304c423166 @derickr committed Nov 10, 2012
Showing with 35 additions and 1 deletion.
  1. +21 −0 tests/bug00898.phpt
  2. +14 −1 xdebug_var.c
View
21 tests/bug00898.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test for bug #898: Wrong works with empty string key in ArrayObject. (>= PHP 5.3)
+--SKIPIF--
+<?php if (!version_compare(phpversion(), "5.3", '>=')) echo "skip >= PHP 5.3 needed\n"; ?>
+--INI--
+xdebug.default_enable=1
+--FILE--
+<?php
+$example = new ArrayObject;
+$example[""] = 'value';
+
+var_dump($example);
+?>
+--EXPECTF--
+class ArrayObject#1 (1) {
+ private $storage =>
+ array(1) {
+ '' =>
+ string(5) "value"
+ }
+}
View
15 xdebug_var.c
@@ -676,6 +676,9 @@ void xdebug_var_export_text_ansi(zval **struc, xdebug_str *str, int mode, int le
HashTable *myht;
char* tmp_str;
int tmp_len;
+#if PHP_VERSION_ID >= 50300
+ int is_temp;
+#endif
if (!struc || !(*struc)) {
return;
@@ -740,8 +743,12 @@ void xdebug_var_export_text_ansi(zval **struc, xdebug_str *str, int mode, int le
break;
case IS_OBJECT:
+#if PHP_VERSION_ID >= 50300
+ myht = Z_OBJDEBUG_PP(struc, is_temp);
+#else
myht = Z_OBJPROP_PP(struc);
- if (myht->nApplyCount < 1) {
+#endif
+ if (myht && myht->nApplyCount < 1) {
char *class_name;
zend_uint class_name_len;
@@ -764,6 +771,12 @@ void xdebug_var_export_text_ansi(zval **struc, xdebug_str *str, int mode, int le
} else {
xdebug_str_add(str, xdebug_sprintf("%*s...\n", (level * 2), ""), 1);
}
+#if PHP_VERSION_ID >= 50300
+ if (is_temp) {
+ zend_hash_destroy(myht);
+ efree(myht);
+ }
+#endif
break;
case IS_RESOURCE: {

0 comments on commit 49c9980

Please sign in to comment.
Something went wrong with that request. Please try again.