PHP-SugarNewsWikiDocsBugsForumFilesSource LoginRegister
HomeForumsGeneral Discussionadd isset() to wishlist, exists a better way or is it a bug?
add isset() to wishlist, exists a better way or is it a bug?
General Discussion
Thomas Buhk Feb 12th, 2008 at 11:51am
with ini_set('error_reporting', E_ALL|E_STRICT); unset array values/indices return an php error while parsing the template files. i'm not sure what the best solution for this problem is:

- a new command isset() within templates
- maybe a workaround with current functionality
- declare it as a bug and fix them inside php-sugar

any thoughts about it?

greetings,
tom.
Sean Middleditch Feb 12th, 2008 at 2:02pm
I think the proper fix is to do the tests inside of the runtime engine and just return false or null for those lookups. I absolutely do not want template authors to have to add code to avoid PHP errors - that defeats half the purpose of using a template engine (protecting designers from the complexities and design mistakes of PHP).
Thomas Buhk Feb 12th, 2008 at 4:33pm
sound good to me. both (false/null) result with an emtpy string, so they shouldn't break the weboutput
Sean Middleditch Feb 12th, 2008 at 5:09pm
That fix is in SVN. I also added the isset() function, since I realized that might be useful for some oddball use-cases. The function works a little differently than PHP's since I didn't want to make parser changes to support it. You call it like isset($array, 'value') and it returns true if $array['value'] exists. Also works for object properties.
Thomas Buhk Feb 13th, 2008 at 5:55am
great, i tested the svn changes this morning and they work great for me thanks!
Sean Middleditch Feb 13th, 2008 at 6:02am
No problem! I have a couple more very minor bugs I've found to fix, and then I'll release 0.74.

Reply to Topic
or Login