[xdebug-dev] xdebug xdebug/test-4.3.sh xdebug/xdebug_var.c xdebug/tests/bug00280.phpt - Fixed bug #280: var_dump don't display key of array as expected.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 4 Jun 2007 18:05:20 +0200

Date: Mon Jun 4 18:05:20 CEST 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed bug #280: var_dump don't display key of array as expected.

Modified files:
           xdebug/test-4.3.sh (version: 1.3)
           xdebug/xdebug_var.c (version: 1.86)
Added files:
           xdebug/tests/bug00280.phpt (new version: 1.1)

[FILE: /xdebug/test-4.3.sh]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xdebug/test-4.3.sh:1.2 Sat Dec 23 19:04:21 2006 GMT
+++ xdebug/test-4.3.sh Mon Jun 04 14:05:20 2007 GMT
@@ -1 +1 @@
-TEST_PHP_EXECUTABLE=`which php-4.4dev` php-5.2dev /dat/dev/php/php-5.2dev/run-tests.php tests/*.phpt
+TEST_PHP_EXECUTABLE=`which php-4.4dev` php-5.2dev /home/derick/dev/php/php-5.2dev/run-tests.php tests/*.phpt

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- xdebug/xdebug_var.c:1.85 Fri Mar 23 17:37:23 2007 GMT
+++ xdebug/xdebug_var.c Mon Jun 04 14:05:20 2007 GMT
@@ -818,7 +818,8 @@
 
 static int xdebug_array_element_export_fancy(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
 {
- int level, debug_zval;
+ int level, debug_zval, newlen;
+ char *tmp_str;
         xdebug_str *str;
         xdebug_var_export_options *options;
         TSRMLS_FETCH();
@@ -836,7 +837,11 @@
                 if (hash_key->nKeyLength==0) { /* numeric key */
                         xdebug_str_add(str, xdebug_sprintf("%ld <font color='%s'>=&gt;</font> ", hash_key->h, COLOR_POINTER), 1);
                 } else { /* string key */
- xdebug_str_add(str, xdebug_sprintf("'%s' <font color='%s'>=&gt;</font> ", hash_key->arKey, COLOR_POINTER), 1);
+ xdebug_str_addl(str, "'", 1, 0);
+ tmp_str = xdebug_xmlize(hash_key->arKey, hash_key->nKeyLength - 1, &newlen);
+ xdebug_str_addl(str, tmp_str, newlen, 0);
+ efree(tmp_str);
+ xdebug_str_add(str, xdebug_sprintf("' <font color='%s'>=&gt;</font> ", COLOR_POINTER), 1);
                 }
                 xdebug_var_export_fancy(zv, str, level + 1, debug_zval, options TSRMLS_CC);
         }
@@ -1119,7 +1124,10 @@
 
                 tmp2 = php_str_to_str(tmp, len, "\n", 1, "&#10;", 5, newlen);
                 efree(tmp);
- return tmp2;
+
+ tmp = php_str_to_str(tmp2, len, "\0", 1, "&#0;", 4, newlen);
+ efree(tmp2);
+ return tmp;
         } else {
                 *newlen = len;
                 return estrdup(string);

[FILE: /xdebug/tests/bug00280.phpt]

--TEST--
Test for bug #280: var_dump don't display key of array as expected
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
--FILE--
<?php
$var = "te\0st";
$arr = array($var=>$var);
ini_set('html_errors', '1');
var_dump($arr);
?>
--EXPECT--
<pre>
<b>array</b>
  'te&#0;st' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'te&#0;st'</font> <i>(length=5)</i>
</pre>
Received on Mon Jun 04 2007 - 18:05:24 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST