Re: Re: is_a() calls in PEAR.php

From: Date: Fri, 07 May 2004 15:33:56 +0000
Subject: Re: Re: is_a() calls in PEAR.php
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-28966@lists.php.net to get a copy of this message
> They are mainly used to check, whether the the method has been > statically, or from within a subclass of PEAR. ... and this is the reason why PEAR_Error contains so much bugs :-( (see Alan's example) I once offered a hack with this static function: class StaticTools { /** * Detects if a method is called staticly (mostly). * * Note: Won't work on calls like parent::function() * * @return bool true, if staticly * false, if not staticly or PHP < 4.3 * @access public * @static */ function isCalledStaticly() { if (function_exists("debug_backtrace")) { // PHP >= 4.3 $stack = debug_backtrace(); if ("::" == $stack[1]["type"]) return TRUE; } return FALSE; } } You can replace calls is_a($this, 'PEAR') by StaticTools::isCalledStaticly() I hope that the current problems regarding PEAR_Error will go away by replacing it with Error_Stack. Markus Kalkbrenner

« previous php.pear.dev (#28966) next »