Uploaded image for project: 'Log4php'
  1. Log4php
  2. LOG4PHP-127

PHP Fatal error: Nesting level too deep - recursive dependency? when logging an object with recursive dependancies

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.0.0
    • None
    • Code
    • None
    • linux ubuntu 8.04
      php 5.2
      Log4php 2.0.0

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              davidp@zoosk.com David Pattison
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: