cvs: smarty /libs/internals core.write_compiled_include.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1106815883@cvsserver>
messju		Thu Jan 27 03:51:23 2005 EDT

  Modified files:              
    /smarty/libs/internals	core.write_compiled_include.php 
  Log:
  added a more robust implementation when removing of the trailing
  '<?php '-token after toke_get_all() . this is also a workaround for
  http://bugs.php.net/bug.php?id=29761
  
  
  
http://cvs.php.net/diff.php/smarty/libs/internals/core.write_compiled_include.php?r1=1.3&r2=1.4&ty=u
Index: smarty/libs/internals/core.write_compiled_include.php
diff -u smarty/libs/internals/core.write_compiled_include.php:1.3 smarty/libs/internals/core.write_compiled_include.php:1.4
--- smarty/libs/internals/core.write_compiled_include.php:1.3	Fri Oct  1 11:26:44 2004
+++ smarty/libs/internals/core.write_compiled_include.php	Thu Jan 27 03:51:21 2005
@@ -43,7 +43,19 @@
         if ($this_varname == '_smarty') {
             /* rename $this to $_smarty in the sourcecode */
             $tokens = token_get_all('<?php ' . $_match[4]);
-            array_shift($tokens); /* remove the opening <.?.php */
+
+            /* remove trailing <?php */
+            $open_tag = '';
+            while ($tokens) {
+                $token = array_shift($tokens);
+                if (is_array($token)) {
+                    $open_tag .= $token[1];
+                } else {
+                    $open_tag .= $token;
+                }
+                if ($open_tag == '<?php ') break;
+            }
+
             for ($i=0, $count = count($tokens); $i < $count; $i++) {
                 if (is_array($tokens[$i])) {
                     if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {

-- 
Smarty CVS Mailing List (http://cvs.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.