SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Call to a member function add() on a non-object

    Hi, I am trying to modify this message board system called FOG, it's a Smarty template based forum.

    I getting the error "Call to a member function add() on a non-object " at the bold line:

    Code:
    function FOGErrorHandler($n,$str,$file,$line,$context){
    	global $fog_log;
    	static $array = array(
    			      E_NOTICE => 'Notice',
    			      E_WARNING => 'Warning',
    			      E_USER_NOTICE => 'User Notice',
    			      E_USER_WARNING => 'User Warning',
    			      E_USER_ERROR => 'User Error'
    	);
    	$ns = isset($array[$n])?$array[$n]:(' Error #'.$n);
    	if((FOG_OPTION_DISPLAY_ERRORS || $n === E_USER_ERROR) && ($n != E_NOTICE || $fog_log->level > $fog_log->levels['ERROR']))
    		echo '<pre>PHP : <strong>',$ns,'</strong> : ',$str,'<br /><em> in file <strong>',$file,'</strong> at line <strong>',$line,'</strong></em></pre>';
    	if($n !== E_NOTICE){
    		$s = $str.' <strong>'.$file.'#'.$line.'</strong>';
    		if($fog_log->level > $fog_log->levels['NOTICE']){			
    			$tmp = debug_backtrace();
    			if(isset($tmp[0]['args'][4])) //Virer l'argument $context, qui prens trop de place dans le log 
    				unset($tmp[0]['args'][4]);
    			$s.= '<br />BackTrace : <br /> '.highlight_string("<?php\n".var_export($tmp,TRUE)."\n?>",TRUE);
    			unset($tmp);
    		}
    		$fog_log->add('ERROR','PHP '.$ns,$s);
    		if($n === E_USER_ERROR)
    			exit('<br /><br />Fatal Error, Aborting...');
    	}
    }
    What's wrong? $fog_log is defined, I don't understand why it's throwing that error.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the bold line to var_dump($fog_log); and paste the output in here.

  3. #3
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Null

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well...$GLOBALS['fog_log'] isnt really an object, it's null


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •