Skip to content

Commit

Permalink
Merged pull request xdebug#37
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Nov 10, 2012
2 parents 9da6d93 + 0bbbe4b commit 49c9980
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
21 changes: 21 additions & 0 deletions 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"
}
}
15 changes: 14 additions & 1 deletion xdebug_var.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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: {
Expand Down

0 comments on commit 49c9980

Please sign in to comment.