php - Compile Error: Cannot use isset() on the result of an expression -


i'm getting error in app migrating sf2.0.x sf2.7:

[1] symfony\component\debug\exception\fatalerrorexception: compile error: cannot use isset() on result of expression (you can use "null !== expression" instead)     @ n/a         in /var/www/html/reptooln_admin/app/cache/dev/twig/68/7f/63589dd3687cb849dd68e6b6c10aa99eda1d82f95a5f3ac52a864d200499.php line 39 

i don't know failing or how fix need advise. line @ cache file stacktrace reported:

    if ((((empty((isset($context["form_action"]) ? $context["form_action"] : $this->getcontext($context, "form_action"))) == true) || (isnull((isset($context["form_action"]) ? $context["form_action"] : $this->getcontext($context, "form_action"))) == true)) || (isset((isset($context["form_action"]) ? $context["form_action"] : $this->getcontext($context, "form_action"))) == false))) {                 echo " ";                 $context["form_action"] = "";                 echo " "; 

what have twigextension:

class pdonetwigextension extends \twig_extension {     public function getfilters()     {         return array(             'var_dump'   => new \twig_filter_function('var_dump'),             'empty' => new \twig_filter_function('empty', array($this, 'is_empty')),             'isset' => new \twig_filter_function('isset', array($this, 'is_set')),             'isnull' => new \twig_filter_function('isnull', array($this, 'is_null')),             'ucfirst' => new \twig_filter_function('ucfirst', array($this, 'uc_first')),             'ucwords' => new \twig_filter_function('ucwords', array($this, 'uc_words')),             'count' => new \twig_filter_function('count', array($this, 'co_unt')),             'sizeof' => new \twig_filter_function('sizeof', array($this, 'size_of')),             'concat' => new \twig_filter_function('concat', array($this, 'concat')),             'in_array' => new \twig_filter_function('in_array', array($this, 'inarray')),             'array' => new \twig_filter_function('array', array($this, 'array_')),             'add_to_array' => new \twig_filter_function('add_to_array', array($this, 'add_to_array')),             'replace' => new \twig_filter_function('replace', array($this, 'replace')),             'htmlentitydecode' => new \twig_filter_function('htmlentitydecode', array($this, 'htmlentitydecode'))         );     }      public function is_empty($sentence)     {         return empty($sentence) ? true : false;     }      // rest of methods goes here      public function getname()     {         return 'pdone_twig_extension';     } } 

and i'm using @ template follow:

{% if form_action|empty == true or form_action|isnull == true or form_action|isset == false %} {% set form_action = '' %} {% endif %} 

where issue here? advice?

from documentation:

isset() works variables passing else result in parse error.

you're not directly passing variable isset(). need calculate value first, assign variable, , pass isset().

for example, you're doing @ moment like:

if(isset($something === false)) { } // throws parse error, because $something === false not variable 

what need instead is:

$something = false; if(isset($something)) { ... } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -