EXPR considered harmful. Basically, EXPR does not do what any sane person would expect, i.e. evaluate the expression in the flow of template logic. H:T:P, which we are using because of it's single-pass performance advantage, actually evaluates the ALL EXPR statements in an additional pre-pass. That means you cannot avoid EXPR being evaluated, and that LOOP context or bracketing TMPL_IF conditionals, for example, become irrelevant.
That means to avoid the warnings, you have to ensure all the EXPR variables are defined at the beginning of template processing, which means you might as well define them *with* the values you want that EXPR line to have, since all the template "states" cannot affect the EXPR anyway. That makes it... worse than useless. Even though there are cases where you can guarantee variables are defined, those can and should be written without it. It just encourages additional use in cases where you can't, or where you can sometimes, but not other times, or where it takes 20 hours of debugging just to figure out if you can use it or not. Please, let's avoid wasting any more time on EXPR crappiness. It looks useful, but for us it's not. It violates the logic of the template and behaves like a macro. Death to EXPR. --joe On Thu, Dec 31, 2009 at 11:24 AM, LAURENT Henri-Damien < henridamien.laur...@gmail.com> wrote: > In fact, > from what I know and experienced > TMPL_IF EXPR is quite demanding > if variable is undefined, it writes a log message, and would sometimes > fail. > So that decision was taken to remove that. > hopes that helps. > -- > Henri-Damien LAURENT > > Garry Collum wrote: > > The one time I used EXPR in one of my patches, Galen figuratively > > smacked me around because it added a bunch of garbage to the apache > > logs. I rewrote the patch without EXPR. > > > > Garry > > > > On Wed, Dec 30, 2009 at 3:20 PM, MJ Ray <m...@phonecoop.coop> wrote: > > > >> Owen Leonard asked: > >> > >>> Re: Bug 2670 ( > http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=2670) > >>> > >>> Is it possible to set up guidelines under which EXPR is allowed? If we > >>> can confirm that variables will be output under all circumstances > >>> would an EXPR be allowed? > >>> > >> hdl's bug report doesn't explain why it had to be removed. > >> Is it a performance worry or a security worry? > >> > >> If it's a performance worry, we should probably try to remove it > >> whenever possible. If security, being sure that variables are > >> output every time should be good enough IMO. > >> > >> Hope that helps, > >> -- > >> MJ Ray (slef) Webmaster and LMS developer at | software > >> www.software.coop http://mjr.towers.org.uk | .... co > >> IMO only: see http://mjr.towers.org.uk/email.html | .... op >
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel