Re: Notice: Undefined variable: tplData in includes/xarTemplate.php on line 1056

jojodee <jojodee-8nna1qhvBBM9QQeoy3GH/[email protected]> Sat, 17 May 2008 07:26:22 +0930
Newsgroups gmane.comp.cms.xaraya.user
Organization Xaraya
Message-ID <[email protected]>
mikespub wrote:

>> Yes, php 5.2.5 and above seams to cause this in xaraya...
>> i heard that other php applications also could have issues with 5.2.5 
>> and above so probably something must e fixed in xaraya.
>  > ...
> 
> In the meantime, you can adapt your config.system.php file to ignore
> Notices like this :
> 
>  $systemConfiguration['Exception.ErrorLevel'] = E_ALL ^ E_NOTICE;
> 
> instead of
> 
>  $systemConfiguration['Exception.ErrorLevel'] = E_ALL;
> 
> (or whatever setting you're using)
> 
> Not sure why the $tplData variable would suddenly be undefined
> though, or why the assert(is_array($tplData)... doesn't give you
> an exception either :-)
> 
> I'm running xaraya 1.x and 2.x with PHP 5.2.5 on Windows without
> any of those problems...
> 
> Mike.

Hi Mike,

Nice to see you :)

I also got this error when i used php 5.2.6. I've posted in the forums 
and this is a repeat of that for reference.

--
Xaraya works fine on php 5.2.5 on nix (at least ubuntu, freebsd, and a 
few others), windows and macosx for me.

However the few systems i've tested on in 5.2.6, xaraya dies as 
described. Looks like 2 types of errors to me.

Setting E_ERROR & ~E_NOTICE for reporting can get us through a few 
problems evident for example in installer on php 5.2.6, for instance 
with an unset var (tplData) but this is different to the error that 
kills the site, which is due to recursion.

Take the odd construct [in xarTemplate.php at xarTpl__execute]:

$tplData['_bl_data'] = $tplData;

It seems treatment of this assignment has changed - at least the error 
level in 5.2.6.

The assignment as it is results in recursion and kills xaraya as 
described. $tplData can be a an empty array or non empty array passed 
into that function (xarTpl__execute) but it will still fail at that 
assignment.

So we can fix it easy enough for now:

$temp = $tplData;
$tplData['_bl_data']=$temp;

or
  tplData['_bl_data'] = &$tplData; should also work.


Jo


-- 
http://xarigami.com :: Creative web development with Xaraya