[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/tests/xdebug_var_dump_non_overload.phpt xdebug/tests/bug00089.phpt xdebug/tests/bug00280.phpt xdebug/tests/xdebug_var_dump.phpt - Added the xdebug.overload_var_dump setting which allows you to turn off

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 23 Aug 2007 21:44:31 +0200

Date: Thu Aug 23 21:44:31 CEST 2007
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Added the xdebug.overload_var_dump setting which allows you to turn off
  Xdebug's version of var_dump().

Modified files:
           xdebug/php_xdebug.h (version: 1.138)
           xdebug/xdebug.c (version: 1.407)
           xdebug/tests/bug00089.phpt (version: 1.6)
           xdebug/tests/bug00280.phpt (version: 1.2)
           xdebug/tests/xdebug_var_dump.phpt (version: 1.7)
Added files:
           xdebug/tests/xdebug_var_dump_non_overload.phpt (new version: 1.1)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -r1.137 -r1.138
--- xdebug/php_xdebug.h:1.137 Wed Aug 15 12:03:58 2007 GMT
+++ xdebug/php_xdebug.h Thu Aug 23 17:44:31 2007 GMT
@@ -141,6 +141,8 @@
         unsigned int prev_memory;
         char *file_link_format;
 
+ zend_bool overload_var_dump;
+ zend_bool var_dump_overloaded;
         void (*orig_var_dump_func)(INTERNAL_FUNCTION_PARAMETERS);
         void (*orig_set_time_limit_func)(INTERNAL_FUNCTION_PARAMETERS);
 

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.406
retrieving revision 1.407
diff -u -r1.406 -r1.407
--- xdebug/xdebug.c:1.406 Wed Aug 15 16:24:00 2007 GMT
+++ xdebug/xdebug.c Thu Aug 23 17:44:31 2007 GMT
@@ -282,6 +282,7 @@
 #else
         STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "100", PHP_INI_ALL, OnUpdateLong, max_nesting_level, zend_xdebug_globals, xdebug_globals)
 #endif
+ STD_PHP_INI_BOOLEAN("xdebug.overload_var_dump", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, overload_var_dump, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_BOOLEAN("xdebug.show_exception_trace", "0", PHP_INI_ALL, OnUpdateBool, show_ex_trace, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_BOOLEAN("xdebug.show_local_vars", "0", PHP_INI_ALL, OnUpdateBool, show_local_vars, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_BOOLEAN("xdebug.show_mem_delta", "0", PHP_INI_ALL, OnUpdateBool, show_mem_delta, zend_xdebug_globals, xdebug_globals)
@@ -800,9 +801,13 @@
         XG(start_time) = xdebug_get_utime();
 
         /* Override var_dump with our own function */
- zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig);
- XG(orig_var_dump_func) = orig->internal_function.handler;
- orig->internal_function.handler = zif_xdebug_var_dump;
+ XG(var_dump_overloaded) = 0;
+ if (XG(overload_var_dump)) {
+ zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig);
+ XG(orig_var_dump_func) = orig->internal_function.handler;
+ orig->internal_function.handler = zif_xdebug_var_dump;
+ XG(var_dump_overloaded) = 1;
+ }
 
         /* Override set_time_limit with our own function to prevent timing out while debugging */
         zend_hash_find(EG(function_table), "set_time_limit", 15, (void **)&orig);
@@ -869,8 +874,10 @@
         xdebug_llist_destroy(XG(collected_errors), NULL);
 
         /* Reset var_dump and set_time_limit to the original function */
- zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig);
- orig->internal_function.handler = XG(orig_var_dump_func);
+ if (XG(var_dump_overloaded)) {
+ zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig);
+ orig->internal_function.handler = XG(orig_var_dump_func);
+ }
         zend_hash_find(EG(function_table), "set_time_limit", 15, (void **)&orig);
         orig->internal_function.handler = XG(orig_set_time_limit_func);
 

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

--TEST--
Test for correct display with non overloaded var_dump() (ZE2)
--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--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.profiler_enable=0
html_errors=1
date.timezone=Europe/Oslo
xdebug.var_display_max_children=11
xdebug.overload_var_dump=0
--FILE--
<?php
        class TimeStuff {
                private $timestamp;
                private $user_defined;
                private $self;
                protected $tm;
                public $date;

                function TimeStuff($ts = null)
                {
                        $this->self = &$this;
                        $this->timestamp = $ts === null ? time() : $ts;
                        $this->user_defined = ($ts !== null);
                        $this->date = date("Y-m-d H:i:s T", $this->timestamp);
                        $this->tm = getdate($this->timestamp);
                }
        }

        $ts1 = new TimeStuff(1092515106);

        var_dump($ts1);
        ini_set('xdebug.overload_var_dump', 1);
        var_dump($ts1);
?>
--EXPECT--
object(TimeStuff)#1 (5) {
  ["timestamp:private"]=>
  int(1092515106)
  ["user_defined:private"]=>
  bool(true)
  ["self:private"]=>
  object(TimeStuff)#1 (5) {
    ["timestamp:private"]=>
    int(1092515106)
    ["user_defined:private"]=>
    bool(true)
    ["self:private"]=>
    *RECURSION*
    ["tm:protected"]=>
    array(11) {
      ["seconds"]=>
      int(6)
      ["minutes"]=>
      int(25)
      ["hours"]=>
      int(22)
      ["mday"]=>
      int(14)
      ["wday"]=>
      int(6)
      ["mon"]=>
      int(8)
      ["year"]=>
      int(2004)
      ["yday"]=>
      int(226)
      ["weekday"]=>
      string(8) "Saturday"
      ["month"]=>
      string(6) "August"
      [0]=>
      int(1092515106)
    }
    ["date"]=>
    string(24) "2004-08-14 22:25:06 CEST"
  }
  ["tm:protected"]=>
  array(11) {
    ["seconds"]=>
    int(6)
    ["minutes"]=>
    int(25)
    ["hours"]=>
    int(22)
    ["mday"]=>
    int(14)
    ["wday"]=>
    int(6)
    ["mon"]=>
    int(8)
    ["year"]=>
    int(2004)
    ["yday"]=>
    int(226)
    ["weekday"]=>
    string(8) "Saturday"
    ["month"]=>
    string(6) "August"
    [0]=>
    int(1092515106)
  }
  ["date"]=>
  string(24) "2004-08-14 22:25:06 CEST"
}
object(TimeStuff)#1 (5) {
  ["timestamp:private"]=>
  int(1092515106)
  ["user_defined:private"]=>
  bool(true)
  ["self:private"]=>
  object(TimeStuff)#1 (5) {
    ["timestamp:private"]=>
    int(1092515106)
    ["user_defined:private"]=>
    bool(true)
    ["self:private"]=>
    *RECURSION*
    ["tm:protected"]=>
    array(11) {
      ["seconds"]=>
      int(6)
      ["minutes"]=>
      int(25)
      ["hours"]=>
      int(22)
      ["mday"]=>
      int(14)
      ["wday"]=>
      int(6)
      ["mon"]=>
      int(8)
      ["year"]=>
      int(2004)
      ["yday"]=>
      int(226)
      ["weekday"]=>
      string(8) "Saturday"
      ["month"]=>
      string(6) "August"
      [0]=>
      int(1092515106)
    }
    ["date"]=>
    string(24) "2004-08-14 22:25:06 CEST"
  }
  ["tm:protected"]=>
  array(11) {
    ["seconds"]=>
    int(6)
    ["minutes"]=>
    int(25)
    ["hours"]=>
    int(22)
    ["mday"]=>
    int(14)
    ["wday"]=>
    int(6)
    ["mon"]=>
    int(8)
    ["year"]=>
    int(2004)
    ["yday"]=>
    int(226)
    ["weekday"]=>
    string(8) "Saturday"
    ["month"]=>
    string(6) "August"
    [0]=>
    int(1092515106)
  }
  ["date"]=>
  string(24) "2004-08-14 22:25:06 CEST"
}

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

===================================================================
RCS file: cvstemp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xdebug/tests/bug00089.phpt:1.5 Fri Dec 22 12:51:03 2006 GMT
+++ xdebug/tests/bug00089.phpt Thu Aug 23 17:44:31 2007 GMT
@@ -10,6 +10,7 @@
 xdebug.show_local_vars=0
 html_errors=1
 xdebug.var_display_max_children=3
+xdebug.overload_var_dump=1
 --FILE--
 <?php
 var_dump(array(4, array('', 2, 'node'), false));

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

===================================================================
RCS file: cvstemp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xdebug/tests/bug00280.phpt:1.1 Mon Jun 04 14:05:20 2007 GMT
+++ xdebug/tests/bug00280.phpt Thu Aug 23 17:44:31 2007 GMT
@@ -4,6 +4,7 @@
 <?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--
+xdebug.overload_var_dump=1
 --FILE--
 <?php
 $var = "te\0st";

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

===================================================================
RCS file: cvstemp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xdebug/tests/xdebug_var_dump.phpt:1.6 Fri Dec 22 12:51:03 2006 GMT
+++ xdebug/tests/xdebug_var_dump.phpt Thu Aug 23 17:44:31 2007 GMT
@@ -10,6 +10,7 @@
 html_errors=1
 date.timezone=Europe/Oslo
 xdebug.var_display_max_children=11
+xdebug.overload_var_dump=1
 --FILE--
 <?php
         class TimeStuff {
Received on Thu Aug 23 2007 - 21:45:13 BST

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