Bug in CVS HEAD

Danilo Buerger <[email protected]> Fri, 23 Feb 2007 16:53:30 +0100
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Hey list,

Smarty goes berserk when trying to embed php code:
Having php_handling == SMARTY_PHP_PASSTHRU :

--- template ---
{$smarty.now}<?php echo time(); ?>

--- compile ---
<?php echo time(); ?>
<?php echo '<?' ?>
php echo '<?php echo '<?' ?>
php'; ?>
  echo time(); <?php echo '<?' ?>
php echo '?>'; ?>

--- expected compile ---
<?php echo time(); ?>
<?php echo '<?php'; ?>
  echo time(); <?php echo '?>'; ?>

And when having php_handling == SMARTY_PHP_ALLOW :

--- compile ---
<?php echo time(); ?>
<?php echo '<?' ?>
php echo time(); ?>

--- expected compile ---
<?php echo time(); ?>
<?php echo time(); ?>

Here is the fix:

Index: Smarty_Compiler.class.php
===================================================================
RCS file: /repository/smarty/libs/Smarty_Compiler.class.php,v
retrieving revision 1.389
diff -r1.389 Smarty_Compiler.class.php
357c357
<
---
 >
372c372
<         $compiled_content .= $text_blocks[$i];
---
 >         $compiled_content .= str_replace('<?',$tmp_id,$text_blocks[$i]);

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php