I found little bug, imposible to use '0' as condition parameter
following template don't work ##IFticket.numberoftasks=0## --- ##ENDIFticket.numberoftasks## ##ELSEticket.numberoftasks## ##lang.ticket.numberoftasks## : ##ticket.numberoftasks## ##ENDELSEticket.numberoftasks## problem with if (empty($out[2][$key]) ){ // No = : check if ot empty or not null zero also interpretete as empty, so we need to check length too, or something similar if (empty($out[2][$key]) && !strlen($out[2][$key]) ){ // No = : check if ot empty or not null 2011/2/10 Nicolas Michaux <nicolas-glpi-...@michaux.homelinux.org> > On Thursday 10 February 2011 10:11:05 Denis Linvinus wrote: > > Hello! > Hi, > > > > > As we have problem only with template condition, better decode > > > > only condition. > > > > > > Ok, what about this patch for you? > > > > This patch also works for me. > Great news! > > > But i don't understand why > > > > if (preg_match_all("/##IF([a-z\.]*)[=]?(.*)##/Ui",$string,$out)) { > > > > not the same as > > > > if (preg_match_all("/##IF([a-z\.]*)[=]?(.*?)##/i",$string,$out)) { > Maybe we should double the question mark if the whole expression is > considered ungreedy : > if (preg_match_all("/##IF([a-z\.]*)[=]??(.*)##/Ui",$string,$out)) { > > "The question mark ? changes the behavior of the quantifiers *, +, ? from > "greedy" to "ungreedy" in a "greedy" regular expression. But the same > question mark ? changes the behavior of the quantifiers *, +, ? from > "ungreedy" > to "greedy" in an "ungreedy" regular expression!" > > I didn't test it. > > Nicolas > > _______________________________________________ > Glpi-dev mailing list > Glpi-dev@gna.org > https://mail.gna.org/listinfo/glpi-dev >
_______________________________________________ Glpi-dev mailing list Glpi-dev@gna.org https://mail.gna.org/listinfo/glpi-dev