magento class zend_log not found

After having written a few helper classes in magento, now i have this problem, i’m getting this error

Fatal error: Class ‘Zend_Log’ not found in appcodelocalUhmaProgramHelperData.php on line 33

in line 33 i have this

function WBSAPI_OnceProbe ()
    return ( $this->WBSAPI_CurlCall ( "once?action=probe" , &$result) );//LINE 33

the function i’m calling with the return is this

function WBSAPI_CurlCall ( $service , &$result=null )
    try {
        $s = curl_init();
            curl_setopt($s, CURLOPT_RETURNTRANSFER, 1);
            $output = curl_exec($s);
        $result = json_decode ( $output , TRUE );
        if (!is_array($result)) return (false);
        if (!key_exists('status',$result)) return (false);
        if ($result['status'] != 0) return (false);

        return ( true );
    } catch ( Exception $e ) {
        return ( false );

i’ve been in google for a while, some say that it is a function in my helper that is overwriting a function from magento’s, i put WBSAPI_ to all my functions at the begining, so, it can’t be the cause, i keep getting the same error and i dont know what else to try, need some help here

if it can help, i have some other definitioNs in my file, somthing like this

define ('MYWBSAPIURL','');
define ('MYAPIURL','');

define ('pound',0.453592);
define ('inch', 0.0254);
class Uhma_Program_Helper_Data extends Mage_Core_Helper_Abstract{


2 thoughts on “magento class zend_log not found”

  1. The reason you’re getting that error is

    1. You have PHP code which produces warnings
    2. Magento runs with error handling cranked up to 11
    3. Magento tries to log the error, and can’t find the class.

    The code in question is

    $this->WBSAPI_CurlCall ( "once?action=probe" , &$result) );

    You’re passing a variable by reference at call time (&$result). That’s been depreciated in modern versions of PHP. Without custom error handling, you’ll get an warning something like

    PHP Warning:  Call-time pass-by-reference has been deprecated;

    So, pass in $result without the &. Given than your method has the paramater declared in its prototype as a pass-by-reference, doing so won’t functionally change your code. That should take care of your immediate problem.

    The larger reason Magento’s giving you this error is its custom error handler.

    #File: app/code/core/Mage/Core/functions.php
    function mageCoreErrorHandler($errno, $errstr, $errfile, $errline)
        if (Mage::getIsDeveloperMode()) {
            throw new Exception($errorMessage);
        } else {
            Mage::log($errorMessage, Zend_Log::ERR);

    Since you’re not working in developer mode, Magento tries to log an error using the constant Zend_Log as its type. The problem is (or appears to be) that if your error happens too soon in the Magento bootstrap/dispatch process, Zend_Log hasn’t been loaded yet and the autoloader doesn’t take care of it. That’s why you’re getting your error.

    You should fix your code not to use call-time pass by reference (remove &$result from your calling code, but not from the function definitions). If you don’t want to do that you could try including lib/Zend/Log.php earlier yourself. I think that’s a bad idea so I’ll leave the hows as an exercise for the reader.

    Also, for those not familiar with the term “call time pass by reference”, it means indicating a variable should be passed by reference when you call a method.


    Passing a reference to a function

    $bar = &baz;

    Or declaring a paramater in a method’s prototype indicating it should be passed by reference

    public function applyInApp(&$content)

    is still legal PHP code.

Leave a Reply

Your email address will not be published. Required fields are marked *