php warnings from smarty templates

SteveX
SteveX
@ultrajam
10 years ago
2,589 posts
Looking at my error_log, I see many warnings from smarty templates. I don't think that was happening before.

Developer mode is disabled, so should I be seeing any warnings at all?

Is it possible that php.ini on the server is overriding the jamroom setting of error_reporting?

e.g.:
Quote: [04-May-2016 12:17:27 Europe/Dublin] PHP Notice: Undefined index: profile_quota_id in /home/mysite/public_html/data/cache/ujWorkbookJacket/f5f1fb0af05568b5d652f0de51cc859b^b6b3b68856f667cffd756d3d34333aae2b65174e_1.file.85f82b0f9b1040faae3ef9cee03ddad8^jrGoogleAnalytics^universal.tpl.php on line 34 [6]
[04-May-2016 12:17:27 Europe/Dublin] PHP Notice: Undefined index: profile_quota_id in /home/mysite/public_html/data/cache/ujWorkbookJacket/f5f1fb0af05568b5d652f0de51cc859b^48963a8d5a8a538c290fdf33a3d1715cd9ffffe5_1.file.79c5d3667f71ab0cf4d1d9b67e4e5cd0^ujWorkbookJacket^profile_header.tpl.php on line 41 [4]



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 09/01/16 04:05:51PM
SteveX
SteveX
@ultrajam
10 years ago
2,589 posts
This is what I have in the template:
{if $entry.active} active{/if}

This is what is written to the log
Quote: [04-May-2016 12:17:27 Europe/Dublin] PHP Notice: Undefined index: active in
/home/mysite/public_html/data/cache/ujWorkbookJacket/f5f1fb0af05568b5d652f0de51cc859b^b837392bfe93f59334d620107f72ed729b69f7
a5_1.file.a8f34af511c3170d099044f85248b8d7^ujWorkbookJacket^header_menu.tpl.php on line 106 [1]



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 05/04/16 05:52:30AM
michael
@michael
10 years ago
7,826 posts
you could get rid of it with an isset, but is that the issue?
{if isset($entry.active) && $entry.active} active{/if}
SteveX
SteveX
@ultrajam
10 years ago
2,589 posts
Thanks Michael, I'm pretty sure there were no warnings from smarty templates before, so I'm wondering why I'm seeing them now.

Should the Jamroom error_reporting be overriding what is set in php.ini?


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
10 years ago
7,826 posts
I know on my dev machine where I have xdebug installed my jamroom error logs get full stack traces in them, so I think jamroom just logs whatever the server setting are.
SteveX
SteveX
@ultrajam
10 years ago
2,589 posts
I have found a way to get the error reporting back to something more manageable, and closer to how I remember it reporting.

In jrCore_parse_template, unless developer mode is on I set
$GLOBALS['smarty_object']->error_reporting = 0;

This gets me back to listing php notices for scripts, with nothing reported from the smarty templates.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
10 years ago
7,826 posts
http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index#4261200
Quote: ......Although PHP does not require variable declaration, it does recommend it.....

Its just a note saying active's not set. If if it is set is what's being checked for, then go with just isset
{if isset($entry.active)} active{/if}

Get the peace of mind of being overly-correct. :)

Tags