|
add isset() to wishlist, exists a better way or is it a bug?
General Discussion
|
|
|||
|
|
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. |
||
|
|||
|
|
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). | ||
|
|||
|
|
sound good to me. both (false/null) result with an emtpy string, so they shouldn't break the weboutput ![]() |
||
|
|||
|
|
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. | ||
|
|||
|
|
great, i tested the svn changes this morning and they work great for me thanks! |
||
|
|||
|
|
No problem! I have a couple more very minor bugs I've found to fix, and then I'll release 0.74. | ||