tag 572265 + patch
thanks

On Mon, 15 Mar 2010 22:01:40 +0100, Thomas Weber wrote:

> I didn't actually test it, but 
> http://pear.php.net/package/Log/download/
> indicates that the 1.12.0 version of Pear Log fixes this. 

Looking at the code [0] the relevant change seems to be in:

#v+
Index: Log.php
===================================================================
--- Log.php     (revision 292696)
+++ Log.php     (revision 292697)
@@ -102,28 +102,6 @@
                             '%\{'           => '%%{');
 
     /**
-     * Utility function which wraps PHP's class_exists() function to ensure
-     * consistent behavior between PHP versions 4 and 5.  Autoloading behavior
-     * is always disabled.
-     *
-     * @param string $class     The name of the class whose existence should
-     *                          be tested.
-     *
-     * @return bool             True if the class exists.
-     *
-     * @access private
-     * @since Log 1.9.13
-     */
-    function _classExists($class)
-    {
-        if (version_compare(PHP_VERSION, '5.0.0', 'ge')) {
-            return class_exists($class, false);
-        }
-
-        return class_exists($class);
-    }
-
-    /**
      * Attempts to return a concrete Log instance of type $handler.
      *
      * @param string $handler   The type of concrete Log subclass to return.
@@ -160,13 +138,13 @@
          * a failure as fatal.  The caller may have already included their own
          * version of the named class.
          */
-        if (!Log::_classExists($class)) {
+        if (!class_exists($class, false)) {
             include_once $classfile;
         }
 
         /* If the class exists, return a new instance of it. */
-        if (Log::_classExists($class)) {
-            $obj = &new $class($name, $ident, $conf, $level);
+        if (class_exists($class, false)) {
+            $obj = new $class($name, $ident, $conf, $level);
             return $obj;
         }
 
@@ -429,11 +407,7 @@
             } else if (method_exists($message, 'tostring')) {
                 $message = $message->toString();
             } else if (method_exists($message, '__tostring')) {
-                if (version_compare(PHP_VERSION, '5.0.0', 'ge')) {
-                    $message = (string)$message;
-                } else {
-                    $message = $message->__toString();
-                }
+                $message = (string)$message;
             } else {
                 $message = var_export($message, true);
             }

#v-

I'm not sure if this is enough, therefore I'd rather someone tests
this.

Of course someone adopting php-log and integrating the whole new
upstream release would make more sense in the long run.

Cheers,
gregor

[0]
Commit 292697 in http://svn.php.net/repository/pear/packages/Log/trunk
-- 
 .''`.   http://info.comodo.priv.at/ -- GPG Key IDs: 0x8649AA06, 0x00F3CFE4
 : :' :  Debian GNU/Linux user, admin, & developer - http://www.debian.org/
 `. `'   Member of VIBE!AT & SPI, fellow of Free Software Foundation Europe
   `-    NP: Eagles: Victim of Love

Attachment: signature.asc
Description: Digital signature

Reply via email to