Two possible bugs in Smarty: {debug} & append()

Peter Billen <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Hi,

I noticed some 'strange' behaviour in Smarty. I didn't/don't have much time to
look into it, so maybe it false alarm.

1)

Template:

<html>
<body>
{debug}
</body>
</html>

Code:

require 'lib/Smarty-2.6.4/libs/Smarty.class.php';

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = true;
$smarty->display('index.html');

Error: Notice: Undefined index: output in
d:\htdocs\smartytest\lib\Smarty-2.6.4\libs\plugins\function.debug.php on line
26

I think if($params['output']) in function.debug.php should be
if(isset($params['output']))

2)

Code:

$categoriesOne[3]['a'] = "Category 3 - a";
$categoriesOne[3]['b'] = "Category 3 - b";
$categoriesOne[7]['a'] = "Category 7 - a";
$categoriesOne[7]['b'] = "Category 7 - b";

$smarty->append("categories", $categoriesOne, true);

$categoriesTwo[7]['c'] = "Category 7 - c";

$smarty->append("categories", $categoriesTwo, true);

Error: $categories contains:

3 => Array (2)
  a => Category 3 - a
  b => Category 3 - b
7 => Array (1)
  c => Category 7 - c

Why doesn't $categories contain:

3 => Array (2)
  a => Category 3 - a
  b => Category 3 - b
7 => Array (1)
  a => Category 7 - a
  b => Category 7 - b
  c => Category 7 - c

It doesn't seem logical to me that index 'a' and 'b' of $categories[7] dissapear
when appending a 'new' index 'c'. I wanted to build an array ($categories) in
several seperate functions (so index 'a' and 'b' are done in one function, and
index 'c' in another one), but old rows got deleted when inserting a new index
to the same array. Is there some kind of walk-arround, or do I need to code
this myself? (can't be that difficult though)

Regards,

-- 
Peter

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.