def / undef Bug

Author Message

Marko Žmak

Friday 25 November 2005 6:34:08 am

I encountered this "bug" with the undef operator. When I "undef" a variable previously declared with "def" i get a "undefined variable" error. Here is the scenario...

I have "template1.tpl" like this:

{def $myvar=1}
{include uri='design:template2.tpl}
My variable in template1: {$myvar}

and "template2.tpl" like this:

My variable in template2: {$myvar}
{undef $myvar}

The output of this code is like this:

My variable in template2: 1
My variable in template1: 

That's OK, since undef destroyed $myvar variable, but in the debug I get the following error:

Undefined Variable: $:myvar, cannot unset

I think that this error shouldn't happen because $myvar i defined, and also undef actually destroys it, so it's confusing, especially when you use it often.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Monday 28 November 2005 2:32:55 pm

Could someone take a look at this "bug":

http://ez.no/community/bugs/def_undef_bug

I understand the answer why the bug is closed, but why then the variable IS UNDEFINED when "undef" is called from the other template?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.