PHP Fatal error: Nesting level too deep - recursive dependency? when logging an
object with recursive dependancies
------------------------------------------------------------------------------------------------------------------
Key: LOG4PHP-127
URL: https://issues.apache.org/jira/browse/LOG4PHP-127
Project: Log4php
Issue Type: Bug
Components: Code
Affects Versions: 2.0
Environment: linux ubuntu 8.04
php 5.2
Log4php 2.0.0
Reporter: David Pattison
I ran into a problem when you try to log an object with a circular dependency,
such as $GLOBALS
here is a phpsh example:
php> require 'Logger.php';
php> Logger::getLogger('foo')->debug($GLOBALS);
array (
'GLOBALS' =>
array (
'GLOBALS' =>
array (
'GLOBALS' =>
array (
Fatal error: Nesting level too deep - recursive dependency? in
/Users/davidp/Documents/workspace/zoosk-trunk-features/tools/include/vendor/log4php/renderers/LoggerRendererDefault.php
on line 49
I am planing to patch my system so it uses print_r() which will not die in
theses cases.
When I do that I would get this output:
php> require 'Logger.php';Logger::getLogger('foo')->debug($GLOBALS);
Thu Oct 14 18:58:48 2010,051 [2688] DEBUG foo - Array
(
[GLOBALS] => Array
*RECURSION*
[_ENV] => Array
(
[TERM_PROGRAM] => Apple_Terminal
[SHELL] => /bin/bash
[TERM] => xterm-color
[TMPDIR] => /var/folders/ME/ME4jssgwHQKMN3vofuUXEU++03M/-Tmp-/
[Apple_PubSub_Socket_Render] => /tmp/launch-pRh4q5/Render
[TERM_PROGRAM_VERSION] => 273
... ommited...
some links about theses two methods:
http://www.php.net/manual/en/function.var-export.php
http://www.php.net/manual/en/function.print-r.php
Thanks,
Dave
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.