[xdebug-general] Re: How to access the original var_dump()?

From: Thomas Forster <me[@]forestfactory.de>
Date: Sun, 11 Mar 2007 05:09:03 +0100

xdebug-general[@]lists.xdebug.org schrieb:
>> My question is if there is any way to get access to the original
>> var_dump() return value? Or would it be possible to implement a function
>> to XDebug that returns this without modifications (e.g.
>> xdebug_original_var_dump())? This would allow to use both tool at the
>> same time with no limitations.
> You should be using var_export or serialize for this:

Sorry, but this is not a good advice: var_export is not save for
recursive dependencies -> var_export($GLOBALS).
serialize is recursive dependency safe, but it sets the recursive
dependencies to NULL -> serialize($GLOBALS). It is not distinguishable
if a value is really NULL or a recursive dependency. This would lead to
incorrect dumps and would render HLI rather useless.

> Better yet: http://php.net/reflection

I agree as for PHP 5.1, but PHP 5.2 disallows access to
private/protected properties by reflection. As you can see here:
http://bugs.php.net/bug.php?id=40348&thanks=4 I already tried that way,
and the advise was to use var_dump() ...

I think it's not good style to change original PHP functions by
extensions, but I do understand that this makes sense for XDebug. But
would it be to hard to provide the original output in some different
function? Or to be able to disable the XDebug var_dump by
xdebug_disable()? Or something like this?


Received on Sun Mar 11 2007 - 05:09:03 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST