Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

smarty_modifier_debug_print_var has potential infinite loop

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
Zefard
Smarty n00b


Joined: 06 Jun 2007
Posts: 1

PostPosted: Wed Jun 06, 2007 12:38 pm    Post subject: smarty_modifier_debug_print_var has potential infinite loop Reply with quote

When I run following code, Apache is crashed by an inifinite loop.
Code:
<?php
class A {
   var $class_b;
   
   function A () {
      $this->class_b = new B($this);
   }
}

class B {
   var $class_a;
   
   function B ($class_a) {
      $this->class_a = $class_a;
   }
}

require 'Smarty.class.php';
$a = new A();
$smarty = new Smarty;
$smarty->debugging = true;
$smarty->assign("Infinite loop", $a);
$smarty->display('index.tpl');
?>


When I turn debugging off, index.tpl is displayed correctly.
smarty_modifier_debug_print_var function calls recursively themself.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Jun 06, 2007 3:34 pm    Post subject: Reply with quote

Correct. Don't expect this to be fixed.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
skrebbel
Smarty n00b


Joined: 03 Jan 2007
Posts: 4
Location: Eindhoven, the Netherlands

PostPosted: Thu Aug 30, 2007 9:06 am    Post subject: Reply with quote

why not? wouldn't a simple maximum recursion depth solve the problem?

a

Code:
if($depth > 10) return $var;


(or a bit more beautified) should do the job, no?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7361
Location: Lincoln Nebraska, USA

PostPosted: Thu Aug 30, 2007 1:30 pm    Post subject: Reply with quote

Hmm, this causes the same problem:

index.php

Code:
include 'index.php';


Maybe the PHP guys should fix that?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP