php - Smarty internal error -


looking through server php error log has revealed type of php notices comes frequent, , has smarty. i've found a question seems describe same error, there no answer.

the notice following (there different variables stated undefined):

php notice:  undefined variable: is_admin in /usr/share/php/smarty/sysplugins/smarty_internal_data.php on line 291 

i wonder how can possibly debug 1 since no data (like template name) provided.

below i'm gonna give idea of code (which can read in full detail here since it's open-source).

so there 1 global smarty object created in file called header.php, , further in same file global smarty variables set, including 1 notice above:

//init smarty require_once('smarty.class.php');  $smarty = new smarty(); ... $smarty->assign('is_admin', is_admin() ? 1 : 0); 

this header.php included in every file needs show html calling $smarty->display(...). presume in file $smarty object present object has variable called is_admin. however, doesn't seem case.

additionally, "normal" smarty warnings unset variables differently:

php notice:  undefined index: sent_id in /var/www/smarty_dir/templates_c/a5aab2c66c44442365a39981ba9be18e0a1f11ad.file.history.tpl.cache.php on line 123 

any ideas?

upd. i've read logs , see such warnings seemingly arise when user enters page , gets 302 http status. may due following code (which placed after smarty constructor call before variables assigned:

//cookie check if (!is_logged() && isset($_cookie['auth'])) {     if ($user_id = check_auth_cookie()) {         if (user_login('', '', $user_id, $_cookie['auth'])) {             header("location:".$_server['request_uri']);             return;         }     } } 

so guess should move $smarty initialisation after block , help. still i'm curious how relates issue.

i think got it. issue in piece of code including

header("location:".$_server['request_uri']); return; 

my error return not act exit in case, because when call return file required or incuded one, return control file. wasn't aware of feature.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

monitor web browser programmatically in Android? -

c# - Using multiple datasets in RDLC -