cvs: smarty / NEWS /libs Config_File.class.php Smarty.class.php Smarty_Compiler.class.php /libs/internals core.create_dir_structure.php core.is_secure.php core.is_trusted.php /libs/plugins modifier.escape.php

"boots" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsboots1132778165@cvsserver>
boots		Wed Nov 23 15:36:05 2005 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs	Config_File.class.php Smarty.class.php 
                	Smarty_Compiler.class.php 
    /smarty/libs/internals	core.create_dir_structure.php 
                          	core.is_secure.php core.is_trusted.php 
    /smarty/libs/plugins	modifier.escape.php 
  Log:
  replace {} string access with equivalent substr() to avoid E_STRICT warnings in PHP 5.1

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
boots-20051123153605.txt (text/plain, 13.9 KB)
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.516&r2=1.517&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.516 smarty/NEWS:1.517
--- smarty/NEWS:1.516	Wed Nov  9 10:46:36 2005
+++ smarty/NEWS	Wed Nov 23 15:36:01 2005
@@ -1,3 +1,5 @@
+ - replace {} string access with equivalent substr() to avoid E_STRICT
+   warnings in PHP 5.1 (boots)
  - return valid reference in get_config_vars() when given var is
    non-existant (Thomas Schulz, boots)
  - plugin html_image: fix incorrect secure_dir error when
@@ -8,7 +10,7 @@
  - return valid reference in get_template_vars() when given var is
    non-existant (monte)
  - add escape type "urlpathinfo" to escape modifier (monte)
- 
+
 Version 2.6.10 (Aug 5, 2005)
 ----------------------------
 
http://cvs.php.net/diff.php/smarty/libs/Config_File.class.php?r1=1.81&r2=1.82&ty=u
Index: smarty/libs/Config_File.class.php
diff -u smarty/libs/Config_File.class.php:1.81 smarty/libs/Config_File.class.php:1.82
--- smarty/libs/Config_File.class.php:1.81	Fri Aug  5 16:53:02 2005
+++ smarty/libs/Config_File.class.php	Wed Nov 23 15:36:03 2005
@@ -25,7 +25,7 @@
  * @package Smarty
  */
 
-/* $Id: Config_File.class.php,v 1.81 2005/08/05 20:53:02 mohrt Exp $ */
+/* $Id: Config_File.class.php,v 1.82 2005/11/23 20:36:03 boots Exp $ */
 
 /**
  * Config file reading class
@@ -285,9 +285,9 @@
             $line = $lines[$i];
             if (empty($line)) continue;
 
-            if ( $line{0} == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
+            if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
                 /* section found */
-                if ($match[1]{0} == '.') {
+                if (substr($match[1], 0, 1) == '.') {
                     /* hidden section */
                     if ($this->read_hidden) {
                         $section_name = substr($match[1], 1);
@@ -347,7 +347,7 @@
      */
     function _set_config_var(&$container, $var_name, $var_value, $booleanize)
     {
-        if ($var_name{0} == '.') {
+        if (substr($var_name, 0, 1) == '.') {
             if (!$this->read_hidden)
                 return;
             else
http://cvs.php.net/diff.php/smarty/libs/Smarty.class.php?r1=1.520&r2=1.521&ty=u
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.520 smarty/libs/Smarty.class.php:1.521
--- smarty/libs/Smarty.class.php:1.520	Wed Nov  9 10:46:37 2005
+++ smarty/libs/Smarty.class.php	Wed Nov 23 15:36:03 2005
@@ -30,7 +30,7 @@
  * @version 2.6.11-dev
  */
 
-/* $Id: Smarty.class.php,v 1.520 2005/11/09 15:46:37 boots Exp $ */
+/* $Id: Smarty.class.php,v 1.521 2005/11/23 20:36:03 boots Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -1698,8 +1698,8 @@
      */
     function _dequote($string)
     {
-        if (($string{0} == "'" || $string{0} == '"') &&
-            $string{strlen($string)-1} == $string{0})
+        if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') &&
+            substr($string, -1) == substr($string, 0, 1))
             return substr($string, 1, -1);
         else
             return $string;
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.371&r2=1.372&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.371 smarty/libs/Smarty_Compiler.class.php:1.372
--- smarty/libs/Smarty_Compiler.class.php:1.371	Fri Aug  5 16:53:04 2005
+++ smarty/libs/Smarty_Compiler.class.php	Wed Nov 23 15:36:04 2005
@@ -26,7 +26,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.371 2005/08/05 20:53:04 mohrt Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.372 2005/11/23 20:36:04 boots Exp $ */
 
 /**
  * Template compiling class
@@ -361,7 +361,7 @@
         $compiled_content .= $text_blocks[$i];
 
         // remove \n from the end of the file, if any
-        if (($_len=strlen($compiled_content)) && ($compiled_content{$_len - 1} == "\n" )) {
+        if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) {
             $compiled_content = substr($compiled_content, 0, -1);
         }
 
@@ -425,7 +425,7 @@
     function _compile_tag($template_tag)
     {
         /* Matched comment. */
-        if ($template_tag{0} == '*' && $template_tag{strlen($template_tag) - 1} == '*')
+        if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*')
             return '';
         
         /* Split tag into two three parts: command, command modifiers and the arguments. */
@@ -529,7 +529,7 @@
 
             case 'strip':
             case '/strip':
-                if ($tag_command{0}=='/') {
+                if (substr($tag_command, 0, 1)=='/') {
                     $this->_pop_tag('strip');
                     if (--$this->_strip_depth==0) { /* outermost closing {/strip} */
                         $this->_additional_newline = "\n";
@@ -664,7 +664,7 @@
      */
     function _compile_block_tag($tag_command, $tag_args, $tag_modifier, &$output)
     {
-        if ($tag_command{0} == '/') {
+        if (substr($tag_command, 0, 1) == '/') {
             $start_tag = false;
             $tag_command = substr($tag_command, 1);
         } else
@@ -826,7 +826,7 @@
      */
     function _compile_registered_object_tag($tag_command, $attrs, $tag_modifier)
     {
-        if ($tag_command{0} == '/') {
+        if (substr($tag_command, 0, 1) == '/') {
             $start_tag = false;
             $tag_command = substr($tag_command, 1);
         } else {
@@ -1730,7 +1730,7 @@
         }
 
         // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit)
-        if(is_numeric($var_expr{0}))
+        if(is_numeric(substr($var_expr, 0, 1)))
             $_var_ref = $var_expr;
         else
             $_var_ref = substr($var_expr, 1);
@@ -1756,7 +1756,7 @@
                     $_var_name = substr(array_shift($_indexes), 1);
                     $_output = "\$this->_smarty_vars['$_var_name']";
                 }
-            } elseif(is_numeric($_var_name) && is_numeric($var_expr{0})) {
+            } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) {
                 // because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers
                 if(count($_indexes) > 0)
                 {
@@ -1769,11 +1769,11 @@
             }
 
             foreach ($_indexes as $_index) {
-                if ($_index{0} == '[') {
+                if (substr($_index, 0, 1) == '[') {
                     $_index = substr($_index, 1, -1);
                     if (is_numeric($_index)) {
                         $_output .= "[$_index]";
-                    } elseif ($_index{0} == '$') {
+                    } elseif (substr($_index, 0, 1) == '$') {
                         if (strpos($_index, '.') !== false) {
                             $_output .= '[' . $this->_parse_var($_index) . ']';
                         } else {
@@ -1785,8 +1785,8 @@
                         $_var_section_prop = isset($_var_parts[1]) ? $_var_parts[1] : 'index';
                         $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]";
                     }
-                } else if ($_index{0} == '.') {
-                    if ($_index{1} == '$')
+                } else if (substr($_index, 0, 1) == '.') {
+                    if (substr($_index, 1, 1) == '$')
                         $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]";
                     else
                         $_output .= "['" . substr($_index, 1) . "']";
@@ -1795,7 +1795,7 @@
                         $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);
                     } elseif($this->security && substr($_index, 2, 1) == '_') {
                         $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__);
-                    } elseif ($_index{2} == '$') {
+                    } elseif (substr($_index, 2, 1) == '$') {
                         if ($this->security) {
                             $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__);
                         } else {
@@ -1804,7 +1804,7 @@
                     } else {
                         $_output .= $_index;
                     }
-                } elseif ($_index{0} == '(') {
+                } elseif (substr($_index, 0, 1) == '(') {
                     $_index = $this->_parse_parenth_args($_index);
                     $_output .= $_index;
                 } else {
@@ -1901,7 +1901,7 @@
             preg_match_all('~:(' . $this->_qstr_regexp . '|[^:]+)~', $modifier_arg_strings[$_i], $_match);
             $_modifier_args = $_match[1];
 
-            if ($_modifier_name{0} == '@') {
+            if (substr($_modifier_name, 0, 1) == '@') {
                 $_map_array = false;
                 $_modifier_name = substr($_modifier_name, 1);
             } else {
@@ -1923,10 +1923,10 @@
 
             if($_modifier_name == 'default') {
                 // supress notifications of default modifier vars and args
-                if($output{0} == '$') {
+                if(substr($output, 0, 1) == '$') {
                     $output = '@' . $output;
                 }
-                if(isset($_modifier_args[0]) && $_modifier_args[0]{0} == '$') {
+                if(isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') {
                     $_modifier_args[0] = '@' . $_modifier_args[0];
                 }
             }
@@ -1978,7 +1978,7 @@
         /* Extract the reference name. */
         $_ref = substr($indexes[0], 1);
         foreach($indexes as $_index_no=>$_index) {
-            if ($_index{0} != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) {
+            if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) {
                 $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
             }
         }
http://cvs.php.net/diff.php/smarty/libs/internals/core.create_dir_structure.php?r1=1.1&r2=1.2&ty=u
Index: smarty/libs/internals/core.create_dir_structure.php
diff -u smarty/libs/internals/core.create_dir_structure.php:1.1 smarty/libs/internals/core.create_dir_structure.php:1.2
--- smarty/libs/internals/core.create_dir_structure.php:1.1	Thu Sep 16 19:07:32 2004
+++ smarty/libs/internals/core.create_dir_structure.php	Wed Nov 23 15:36:05 2005
@@ -22,7 +22,7 @@
             /* unix-style paths */
             $_dir = $params['dir'];
             $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
-            $_new_dir = ($_dir{0}=='/') ? '/' : getcwd().'/';
+            $_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/';
             if($_use_open_basedir = !empty($_open_basedir_ini)) {
                 $_open_basedirs = explode(':', $_open_basedir_ini);
             }
http://cvs.php.net/diff.php/smarty/libs/internals/core.is_secure.php?r1=1.3&r2=1.4&ty=u
Index: smarty/libs/internals/core.is_secure.php
diff -u smarty/libs/internals/core.is_secure.php:1.3 smarty/libs/internals/core.is_secure.php:1.4
--- smarty/libs/internals/core.is_secure.php:1.3	Wed Aug 17 11:27:40 2005
+++ smarty/libs/internals/core.is_secure.php	Wed Nov 23 15:36:05 2005
@@ -27,7 +27,7 @@
             foreach ((array)$params['resource_base_path'] as $curr_dir) {
                 if ( ($_cd = realpath($curr_dir)) !== false &&
                      strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
-                     $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
+                     substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
                     return true;
                 }
             }
@@ -38,7 +38,7 @@
                     if($_cd == $_rp) {
                         return true;
                     } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
-                        $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR) {
+                        substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
                         return true;
                     }
                 }
http://cvs.php.net/diff.php/smarty/libs/internals/core.is_trusted.php?r1=1.1&r2=1.2&ty=u
Index: smarty/libs/internals/core.is_trusted.php
diff -u smarty/libs/internals/core.is_trusted.php:1.1 smarty/libs/internals/core.is_trusted.php:1.2
--- smarty/libs/internals/core.is_trusted.php:1.1	Thu Sep 16 19:07:32 2004
+++ smarty/libs/internals/core.is_trusted.php	Wed Nov 23 15:36:05 2005
@@ -25,7 +25,7 @@
                 if (!empty($curr_dir) && is_readable ($curr_dir)) {
                     $_cd = realpath($curr_dir);
                     if (strncmp($_rp, $_cd, strlen($_cd)) == 0
-                        && $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
+                        && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
                         $_smarty_trusted = true;
                         break;
                     }
http://cvs.php.net/diff.php/smarty/libs/plugins/modifier.escape.php?r1=1.22&r2=1.23&ty=u
Index: smarty/libs/plugins/modifier.escape.php
diff -u smarty/libs/plugins/modifier.escape.php:1.22 smarty/libs/plugins/modifier.escape.php:1.23
--- smarty/libs/plugins/modifier.escape.php:1.22	Tue Oct 11 12:22:56 2005
+++ smarty/libs/plugins/modifier.escape.php	Wed Nov 23 15:36:05 2005
@@ -72,13 +72,13 @@
            // escape non-standard chars, such as ms document quotes
            $_res = '';
            for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
-               $_ord = ord($string{$_i});
+               $_ord = ord(substr($string, $_i, 1));
                // non-standard char, escape it
                if($_ord >= 126){
                    $_res .= '&#' . $_ord . ';';
                }
                else {
-                   $_res .= $string{$_i};
+                   $_res .= substr($string, $_i, 1);
                }
            }
            return $_res;
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.