php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56227 Fancy var_dump function vs Var_Dump class
Submitted: 2004-11-10 09:46 UTC Modified: 2004-11-27 14:31 UTC
From: fpoeydomenge at free dot fr Assigned:
Status: Not a bug Package: Xdebug
PHP Version: Irrelevant OS: Debian GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fpoeydomenge at free dot fr
New email:
PHP Version: OS:

 

 [2004-11-10 09:46 UTC] fpoeydomenge at free dot fr
Description:
------------
Hi Derick,

The fancy var_dump function, which overrides the default var_dump() in PHP, does not have the same kind of output than the default function : it produces an html dump, whereas the default function produces a plain text dump (without html tags).

The Var_Dump package, whose I am the maintainer, closely depends on the output of the original var_dump() function to operate. And because the two results differ, the result of the Var_Dump class using your fancy replacement, does not produce the expected result (see bug http://pear.php.net/bugs/bug.php?id=2574).

I've seen in the changelog, and in xdebug.c that your function overrides the default PHP function. But in the online documentation, you don't explicitly tell that, because the xdebug_var_dump() function is logically used to do this job.

So I wanted to have your opinion to resolve this problem smoothly : do I need to take care of the result of your function in the Var_Dump class ; or do you think it could be possible to leave the original function as it is, perhaps with a configuration item telling if the user want to override or not the default var_dump function ?

Frederic Poeydomenge

-----
PHP Version 4.3.9-1.dotdeb.3
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Xdebug v1.3.2

Reproduce code:
---------------
<?php
$a = array (1, 2, array ("a", "b", "c"));
var_dump($a);
?> 

Expected result:
----------------
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  array(3) {
    [0]=>
    string(1) "a"
    [1]=>
    string(1) "b"
    [2]=>
    string(1) "c"
  }
}

Actual result:
--------------
<pre>
<b>array</b>
  0 <font color='#777777'>=&gt;</font> <font color='#00bb00'>1</font>
  1 <font color='#777777'>=&gt;</font> <font color='#00bb00'>2</font>
  2 <font color='#777777'>=&gt;</font> 
    <b>array</b>
      0 <font color='#777777'>=&gt;</font> <font
color='#bb00bb'>'a'</font>
      1 <font color='#777777'>=&gt;</font> <font
color='#bb00bb'>'b'</font>
      2 <font color='#777777'>=&gt;</font> <font
color='#bb00bb'>'c'</font>
</pre>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-12 09:58 UTC] fpoeydomenge at free dot fr
Or would it be possible, before the following two lines in xdebug.c :

    zend_hash_find(EG(function_table), "var_dump", 9, (void **)&orig);
    orig->internal_function.handler = zif_xdebug_var_dump;

to create a link/pointer to the original var_dump() function (e.g. _xdebug_old_var_dump()) ?

That would allow to use your fancy var_dump function as usual, but also to call the old function by using something like this :

if (
    extension_loaded('xdebug') and
    function_exists('_xdebug_old_var_dump')
) {
    $func = '_xdebug_old_var_dump';
} else {
    $func = 'var_dump';
}

What do you think of this option ?
Regards
 [2004-11-27 14:31 UTC] derick@php.net
Duplicate of bogus bug http://bugs.xdebug.org/bug_view_page.php?bug_id=0000105

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 09:01:29 2024 UTC