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

Passing an instance of a configurator class to the Logger::configure function gives an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.2.1
    • Code
    • Mac 10.6.8, PHP 5.3.6, Log4php v2.0 from the PEAR repository.

    Description

      I get the following error when I try to pass a configurator object to the Logger::configure() function:

      PHP Warning: class_exists() expects parameter 1 to be string, object given in /var/pear/share/pear/log4php/Logger.php on line 586

      The function where this error is happening is the following:

      /**

      • Creates a logger configurator instance based on the provided
      • configurator class. If no class is given, returns an instance of
      • the default configurator.
      • @param string $configuratorClass The configurator class.
        */
        private static function getConfigurator($configuratorClass = null) {
        if (empty($configuratorClass)) { return new LoggerConfiguratorDefault(); }

      if (!class_exists($configuratorClass))

      { $this->warn("Specified configurator class [$configuratorClass] does not exist. Reverting to default configurator."); return new LoggerConfiguratorDefault(); }

      $configurator = new $configuratorClass();

      if (!($configurator instanceof LoggerConfigurator))

      { $this->warn("Specified configurator class [$configuratorClass] does not implement the LoggerConfigurator interface. Reverting to default configurator."); return new LoggerConfiguratorDefault(); }

      return $configurator;
      }

      I believe that there is a newer release of Log4php already out. If this bug is fixed in the new release then maybe it's time to update the PEAR repo.

      Attachments

        Activity

          People

            juice Ivan Habunek
            emmet Emmet O'Grady
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: