diff --git a/db.inc.php b/db.inc.php index b9447a50..cdce0489 100644 --- a/db.inc.php +++ b/db.inc.php @@ -160,9 +160,9 @@ function sRandomChars($length = 15,$pattern="23456789abcdefghijkmnpqrstuvwxyz") for($i=0;$i<$length;$i++) { if(isset($key)) - $key .= $pattern{mt_rand(0,$patternlength)}; + $key .= $pattern[mt_rand(0,$patternlength)]; else - $key = $pattern{mt_rand(0,$patternlength)}; + $key = $pattern[mt_rand(0,$patternlength)]; } return $key; } diff --git a/include/pear/Console/Getopt.php b/include/pear/Console/Getopt.php index 7966d1ac..b2381628 100644 --- a/include/pear/Console/Getopt.php +++ b/include/pear/Console/Getopt.php @@ -104,7 +104,7 @@ class Console_Getopt { * erroneous POSIX fix. */ if ($version < 2) { - if (isset($args[0]{0}) && $args[0]{0} != '-') { + if (isset($args[0][0]) && $args[0][0] != '-') { array_shift($args); } } @@ -120,10 +120,10 @@ class Console_Getopt { break; } - if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) { + if ($arg[0] != '-' || (strlen($arg) > 1 && $arg[1] == '-' && !$long_options)) { $non_opts = array_merge($non_opts, array_slice($args, $i)); break; - } elseif (strlen($arg) > 1 && $arg{1} == '-') { + } elseif (strlen($arg) > 1 && $arg[1] == '-') { $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args); if (PEAR::isError($error)) return $error; @@ -144,17 +144,17 @@ class Console_Getopt { function _parseShortOption($arg, $short_options, &$opts, &$args) { for ($i = 0; $i < strlen($arg); $i++) { - $opt = $arg{$i}; + $opt = $arg[$i]; $opt_arg = null; /* Try to find the short option in the specifier string. */ - if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':') + if (($spec = strstr($short_options, $opt)) === false || $arg[$i] == ':') { return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt"); } - if (strlen($spec) > 1 && $spec{1} == ':') { - if (strlen($spec) > 2 && $spec{2} == ':') { + if (strlen($spec) > 1 && $spec[1] == ':') { + if (strlen($spec) > 2 && $spec[2] == ':') { if ($i + 1 < strlen($arg)) { /* Option takes an optional argument. Use the remainder of the arg string if there is anything left. */ @@ -199,7 +199,7 @@ class Console_Getopt { /* Check that the options uniquely matches one of the allowed options. */ - if ($opt_rest != '' && $opt{0} != '=' && + if ($opt_rest != '' && $opt[0] != '=' && $i + 1 < count($long_options) && $opt == substr($long_options[$i+1], 0, $opt_len)) { return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous"); diff --git a/include/pear/DB/common.php b/include/pear/DB/common.php index f0cfcb7c..3f4436de 100644 --- a/include/pear/DB/common.php +++ b/include/pear/DB/common.php @@ -247,7 +247,7 @@ class DB_common extends PEAR function quoteString($string) { $string = $this->quote($string); - if ($string{0} == "'") { + if ($string[0] == "'") { return substr($string, 1, -1); } return $string; diff --git a/include/pear/Date/Span.php b/include/pear/Date/Span.php index 32b7bab0..ca989bfd 100644 --- a/include/pear/Date/Span.php +++ b/include/pear/Date/Span.php @@ -304,9 +304,9 @@ class Date_Span $pm = 'am'; $day = $hour = $minute = $second = 0; for ($i = 0; $i < strlen($format); $i++) { - $char = $format{$i}; + $char = $format[$i]; if ($char == '%') { - $nextchar = $format{++$i}; + $nextchar = $format[++$i]; switch ($nextchar) { case 'c': $str .= '%d, %d:%d:%d'; @@ -635,9 +635,9 @@ class Date_Span } $output = ''; for ($i = 0; $i < strlen($format); $i++) { - $char = $format{$i}; + $char = $format[$i]; if ($char == '%') { - $nextchar = $format{++$i}; + $nextchar = $format[++$i]; switch ($nextchar) { case 'C': $output .= sprintf( diff --git a/include/pear/HTML/AJAX/JSON.php b/include/pear/HTML/AJAX/JSON.php index c799c609..8be4c707 100644 --- a/include/pear/HTML/AJAX/JSON.php +++ b/include/pear/HTML/AJAX/JSON.php @@ -161,7 +161,7 @@ class HTML_AJAX_JSON if(function_exists('mb_convert_encoding')) return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); switch(true) { case ((0x7F & $bytes) == $bytes): @@ -213,17 +213,17 @@ class HTML_AJAX_JSON case 2: // return a UTF-16 character from a 2-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); + return chr(0x07 & (ord($utf8[0]) >> 2)) + . chr((0xC0 & (ord($utf8[0]) << 6)) + | (0x3F & ord($utf8[1]))); case 3: // return a UTF-16 character from a 3-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); + return chr((0xF0 & (ord($utf8[0]) << 4)) + | (0x0F & (ord($utf8[1]) >> 2))) + . chr((0xC0 & (ord($utf8[1]) << 6)) + | (0x7F & ord($utf8[2]))); } // ignoring UTF-32 for now, sorry @@ -268,7 +268,7 @@ class HTML_AJAX_JSON */ for ($c = 0; $c < $strlen_var; ++$c) { - $ord_var_c = ord($var{$c}); + $ord_var_c = ord($var[$c]); switch (true) { case $ord_var_c == 0x08: @@ -291,18 +291,18 @@ class HTML_AJAX_JSON case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; + $ascii .= '\\'.$var[$c]; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; + $ascii .= $var[$c]; break; case (($ord_var_c & 0xE0) == 0xC0): // characters U-00000080 - U-000007FF, mask 110XXXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $char = pack('C*', $ord_var_c, ord($var[$c + 1])); $c += 1; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -312,8 +312,8 @@ class HTML_AJAX_JSON // characters U-00000800 - U-0000FFFF, mask 1110XXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2})); + ord($var[$c + 1]), + ord($var[$c + 2])); $c += 2; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -323,9 +323,9 @@ class HTML_AJAX_JSON // characters U-00010000 - U-001FFFFF, mask 11110XXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3])); $c += 3; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -335,10 +335,10 @@ class HTML_AJAX_JSON // characters U-00200000 - U-03FFFFFF, mask 111110XX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3]), + ord($var[$c + 4])); $c += 4; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -348,11 +348,11 @@ class HTML_AJAX_JSON // characters U-04000000 - U-7FFFFFFF, mask 1111110X // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3]), + ord($var[$c + 4]), + ord($var[$c + 5])); $c += 5; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -518,7 +518,7 @@ class HTML_AJAX_JSON for ($c = 0; $c < $strlen_chrs; ++$c) { $substr_chrs_c_2 = substr($chrs, $c, 2); - $ord_chrs_c = ord($chrs{$c}); + $ord_chrs_c = ord($chrs[$c]); switch (true) { case $substr_chrs_c_2 == '\b': @@ -548,7 +548,7 @@ class HTML_AJAX_JSON case $substr_chrs_c_2 == '\\/': if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || ($delim == "'" && $substr_chrs_c_2 != '\\"')) { - $utf8 .= $chrs{++$c}; + $utf8 .= $chrs[++$c]; } break; @@ -561,7 +561,7 @@ class HTML_AJAX_JSON break; case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): - $utf8 .= $chrs{$c}; + $utf8 .= $chrs[$c]; break; case ($ord_chrs_c & 0xE0) == 0xC0: @@ -608,7 +608,7 @@ class HTML_AJAX_JSON } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { // array, or object notation - if ($str{0} == '[') { + if ($str[0] == '[') { $stk = array(SERVICES_JSON_IN_ARR); $arr = array(); } else { @@ -647,7 +647,7 @@ class HTML_AJAX_JSON $top = end($stk); $substr_chrs_c_2 = substr($chrs, $c, 2); - if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { // found a comma that is not inside a string, array, etc., // OR we've reached the end of the character list $slice = substr($chrs, $top['where'], ($c - $top['where'])); @@ -687,37 +687,37 @@ class HTML_AJAX_JSON } - } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { // found a quote, and we are not inside a string - array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c])); //print("Found start of string at {$c}\n"); - } elseif (($chrs{$c} == $top['delim']) && + } elseif (($chrs[$c] == $top['delim']) && ($top['what'] == SERVICES_JSON_IN_STR) && - (($chrs{$c - 1} != '\\') || - ($chrs{$c - 1} == '\\' && $chrs{$c - 2} == '\\'))) { + (($chrs[$c - 1] != '\\') || + ($chrs[$c - 1] == '\\' && $chrs[$c - 2] == '\\'))) { // found a quote, we're in a string, and it's not escaped array_pop($stk); //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); - } elseif (($chrs{$c} == '[') && + } elseif (($chrs[$c] == '[') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { // found a left-bracket, and we are in an array, object, or slice array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); //print("Found start of array at {$c}\n"); - } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { // found a right-bracket, and we're in an array array_pop($stk); //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - } elseif (($chrs{$c} == '{') && + } elseif (($chrs[$c] == '{') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { // found a left-brace, and we are in an array, object, or slice array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); //print("Found start of object at {$c}\n"); - } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { // found a right-brace, and we're in an object array_pop($stk); //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); diff --git a/include/pear/HTML/QuickForm/date.php b/include/pear/HTML/QuickForm/date.php index b1382a05..28f1ce0a 100644 --- a/include/pear/HTML/QuickForm/date.php +++ b/include/pear/HTML/QuickForm/date.php @@ -310,7 +310,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group $locale =& $this->_locale[$this->_options['language']]; $backslash = false; for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) { - $sign = $this->_options['format']{$i}; + $sign = $this->_options['format'][$i]; if ($backslash) { $backslash = false; $separator .= $sign; diff --git a/include/pear/HTTP.php b/include/pear/HTTP.php index 3301702e..cd736f1d 100644 --- a/include/pear/HTTP.php +++ b/include/pear/HTTP.php @@ -326,7 +326,7 @@ class HTTP $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; } - if ($url{0} == '/') { + if ($url[0] == '/') { return $server . $url; } diff --git a/include/pear/OS/Guess.php b/include/pear/OS/Guess.php index 5a661154..8854754d 100644 --- a/include/pear/OS/Guess.php +++ b/include/pear/OS/Guess.php @@ -248,7 +248,7 @@ class OS_Guess $cpp = popen("/usr/bin/cpp $tmpfile", "r"); $major = $minor = 0; while ($line = fgets($cpp, 1024)) { - if ($line{0} == '#' || trim($line) == '') { + if ($line[0] == '#' || trim($line) == '') { continue; } if (list($major, $minor) = explode(' ', trim($line))) { diff --git a/include/pear/PEAR/Autoloader.php b/include/pear/PEAR/Autoloader.php index 8991a012..148fc98f 100644 --- a/include/pear/PEAR/Autoloader.php +++ b/include/pear/PEAR/Autoloader.php @@ -153,7 +153,7 @@ class PEAR_Autoloader extends PEAR $methods = get_class_methods($classname); foreach ($methods as $method) { // don't import priviate methods and constructors - if ($method{0} != '_' && $method != $classname) { + if ($method[0] != '_' && $method != $classname) { $this->_method_map[$method] = $obj; } } diff --git a/include/pear/PEAR/Builder.php b/include/pear/PEAR/Builder.php index 4bb3b405..9561640f 100644 --- a/include/pear/PEAR/Builder.php +++ b/include/pear/PEAR/Builder.php @@ -186,7 +186,7 @@ class PEAR_Builder extends PEAR_Common $ret = true; while (($ent = readdir($d)) !== false) { - if ($ent{0} == '.') + if ($ent[0] == '.') continue; $full = $dirname . DIRECTORY_SEPARATOR . $ent; diff --git a/include/pear/PEAR/Command.php b/include/pear/PEAR/Command.php index 8cb0714e..2c6d4f73 100644 --- a/include/pear/PEAR/Command.php +++ b/include/pear/PEAR/Command.php @@ -244,7 +244,7 @@ class PEAR_Command $GLOBALS['_PEAR_Command_commandlist'] = array(); } while ($entry = readdir($dp)) { - if ($entry{0} == '.' || substr($entry, -4) != '.xml') { + if ($entry[0] == '.' || substr($entry, -4) != '.xml') { continue; } $class = "PEAR_Command_".substr($entry, 0, -4); diff --git a/include/pear/PEAR/Command/Common.php b/include/pear/PEAR/Command/Common.php index 1b18a938..e3c18691 100644 --- a/include/pear/PEAR/Command/Common.php +++ b/include/pear/PEAR/Command/Common.php @@ -162,7 +162,7 @@ class PEAR_Command_Common extends PEAR while (list($option, $info) = each($this->commands[$command]['options'])) { $larg = $sarg = ''; if (isset($info['arg'])) { - if ($info['arg']{0} == '(') { + if ($info['arg'][0] == '(') { $larg = '=='; $sarg = '::'; $arg = substr($info['arg'], 1, -1); @@ -223,7 +223,7 @@ class PEAR_Command_Common extends PEAR $help = "Options:\n"; foreach ($this->commands[$command]['options'] as $k => $v) { if (isset($v['arg'])) { - if ($v['arg']{0} == '(') { + if ($v['arg'][0] == '(') { $arg = substr($v['arg'], 1, -1); $sapp = " [$arg]"; $lapp = "[=$arg]"; diff --git a/include/pear/PEAR/Command/Config.php b/include/pear/PEAR/Command/Config.php index 9836bf23..c57f31c3 100644 --- a/include/pear/PEAR/Command/Config.php +++ b/include/pear/PEAR/Command/Config.php @@ -322,7 +322,7 @@ and uninstall). $root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"), array('/', '/', '/'), $root); - if ($root{0} != '/') { + if ($root[0] != '/') { if (isset($options['windows'])) { if (!preg_match('/^[A-Za-z]:/', $root)) { return PEAR::raiseError('Root directory must be an absolute path beginning ' . @@ -344,7 +344,7 @@ and uninstall). } $params[1] = realpath($params[1]); $config = &new PEAR_Config($params[1], '#no#system#config#', false, false); - if ($root{strlen($root) - 1} == '/') { + if ($root[strlen($root) - 1] == '/') { $root = substr($root, 0, strlen($root) - 1); } $config->noRegistry(); diff --git a/include/pear/PEAR/Common.php b/include/pear/PEAR/Common.php index 7bcbec4f..e3476868 100644 --- a/include/pear/PEAR/Common.php +++ b/include/pear/PEAR/Common.php @@ -611,7 +611,7 @@ class PEAR_Common extends PEAR foreach ($methods as $method) { $function = "$class::$method"; $key = "function;$function"; - if ($method{0} == '_' || !strcasecmp($method, $class) || + if ($method[0] == '_' || !strcasecmp($method, $class) || isset($this->pkginfo['provides'][$key])) { continue; } @@ -622,7 +622,7 @@ class PEAR_Common extends PEAR foreach ($srcinfo['declared_functions'] as $function) { $key = "function;$function"; - if ($function{0} == '_' || isset($this->pkginfo['provides'][$key])) { + if ($function[0] == '_' || isset($this->pkginfo['provides'][$key])) { continue; } if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) { diff --git a/include/pear/PEAR/Config.php b/include/pear/PEAR/Config.php index c13c74fe..6dae3c3a 100644 --- a/include/pear/PEAR/Config.php +++ b/include/pear/PEAR/Config.php @@ -2058,7 +2058,7 @@ class PEAR_Config extends PEAR if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) { if (preg_match('/^[a-z]:/i', $prepend)) { $prepend = substr($prepend, 2); - } elseif ($prepend{0} != '\\') { + } elseif ($prepend[0] != '\\') { $prepend = "\\$prepend"; } $path = substr($path, 0, 2) . $prepend . substr($path, 2); diff --git a/include/pear/PEAR/DependencyDB.php b/include/pear/PEAR/DependencyDB.php index db8856a6..ac160632 100644 --- a/include/pear/PEAR/DependencyDB.php +++ b/include/pear/PEAR/DependencyDB.php @@ -171,7 +171,7 @@ class PEAR_DependencyDB if ($depdb['_version'] < $this->_version) { $this->rebuildDB(); } - if ($depdb['_version']{0} > $this->_version{0}) { + if ($depdb['_version'][0] > $this->_version[0]) { return PEAR::raiseError('Dependency database is version ' . $depdb['_version'] . ', and we are version ' . $this->_version . ', cannot continue'); diff --git a/include/pear/PEAR/Downloader.php b/include/pear/PEAR/Downloader.php index 1368bc04..a8a41d70 100644 --- a/include/pear/PEAR/Downloader.php +++ b/include/pear/PEAR/Downloader.php @@ -1078,7 +1078,7 @@ class PEAR_Downloader extends PEAR_Common if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) { if (preg_match('/^[a-z]:/i', $prepend)) { $prepend = substr($prepend, 2); - } elseif ($prepend{0} != '\\') { + } elseif ($prepend[0] != '\\') { $prepend = "\\$prepend"; } $path = substr($path, 0, 2) . $prepend . substr($path, 2); diff --git a/include/pear/PEAR/Installer.php b/include/pear/PEAR/Installer.php index bdb59160..888d6632 100644 --- a/include/pear/PEAR/Installer.php +++ b/include/pear/PEAR/Installer.php @@ -222,7 +222,7 @@ class PEAR_Installer extends PEAR_Downloader if (empty($os)) { $os = new OS_Guess(); } - if (strlen($atts['platform']) && $atts['platform']{0} == '!') { + if (strlen($atts['platform']) && $atts['platform'][0] == '!') { $negate = true; $platform = substr($atts['platform'], 1); } else { diff --git a/include/pear/PEAR/Installer/Role.php b/include/pear/PEAR/Installer/Role.php index b97b8080..ff528ff7 100644 --- a/include/pear/PEAR/Installer/Role.php +++ b/include/pear/PEAR/Installer/Role.php @@ -221,7 +221,7 @@ class PEAR_Installer_Role return PEAR::raiseError("registerRoles: opendir($dir) failed"); } while ($entry = readdir($dp)) { - if ($entry{0} == '.' || substr($entry, -4) != '.xml') { + if ($entry[0] == '.' || substr($entry, -4) != '.xml') { continue; } $class = "PEAR_Installer_Role_".substr($entry, 0, -4); diff --git a/include/pear/PEAR/PackageFile.php b/include/pear/PEAR/PackageFile.php index 41842de5..b65c8a5c 100644 --- a/include/pear/PEAR/PackageFile.php +++ b/include/pear/PEAR/PackageFile.php @@ -99,12 +99,12 @@ class PEAR_PackageFile */ function &parserFactory($version) { - if (!in_array($version{0}, array('1', '2'))) { + if (!in_array($version[0], array('1', '2'))) { $a = false; return $a; } - include_once 'PEAR/PackageFile/Parser/v' . $version{0} . '.php'; - $version = $version{0}; + include_once 'PEAR/PackageFile/Parser/v' . $version[0] . '.php'; + $version = $version[0]; $class = "PEAR_PackageFile_Parser_v$version"; $a = new $class; return $a; @@ -126,12 +126,12 @@ class PEAR_PackageFile */ function &factory($version) { - if (!in_array($version{0}, array('1', '2'))) { + if (!in_array($version[0], array('1', '2'))) { $a = false; return $a; } - include_once 'PEAR/PackageFile/v' . $version{0} . '.php'; - $version = $version{0}; + include_once 'PEAR/PackageFile/v' . $version[0] . '.php'; + $version = $version[0]; $class = $this->getClassPrefix() . $version; $a = new $class; return $a; diff --git a/include/pear/PEAR/PackageFile/Generator/v1.php b/include/pear/PEAR/PackageFile/Generator/v1.php index c6968f4e..10a3107a 100644 --- a/include/pear/PEAR/PackageFile/Generator/v1.php +++ b/include/pear/PEAR/PackageFile/Generator/v1.php @@ -875,13 +875,13 @@ class PEAR_PackageFile_Generator_v1 } //o tags for if (isset($package['platform'][$file]) && - $package['platform'][$file]{0} == '!') { + $package['platform'][$file][0] == '!') { $generic[] = $file; continue; } //o tags for if (isset($package['platform'][$file]) && - $package['platform'][$file]{0} != '!') { + $package['platform'][$file][0] != '!') { $genericIgnore[] = $file; continue; } @@ -890,7 +890,7 @@ class PEAR_PackageFile_Generator_v1 if (isset($package['install-as'][$file])) { continue; } - if ($platform{0} != '!') { + if ($platform[0] != '!') { //o tags for $genericIgnore[] = $file; } @@ -899,7 +899,7 @@ class PEAR_PackageFile_Generator_v1 $oses = $notplatform = $platform = array(); foreach ($package['platform'] as $file => $os) { // get a list of oses - if ($os{0} == '!') { + if ($os[0] == '!') { if (isset($oses[substr($os, 1)])) { continue; } @@ -945,7 +945,7 @@ class PEAR_PackageFile_Generator_v1 // if (isset($package['platform'][$file]) && $package['platform'][$file] != "!$os" && - $package['platform'][$file]{0} == '!') { + $package['platform'][$file][0] == '!') { $release[$releaseNum]['filelist']['install'][] = array( 'attribs' => array( @@ -970,7 +970,7 @@ class PEAR_PackageFile_Generator_v1 //o tags for // if (isset($package['platform'][$file]) && - $package['platform'][$file]{0} != '!' && + $package['platform'][$file][0] != '!' && $package['platform'][$file] != $os) { $release[$releaseNum]['filelist']['ignore'][] = array( @@ -996,7 +996,7 @@ class PEAR_PackageFile_Generator_v1 continue; } //o tags for - if ($platform{0} != '!' && $platform != $os) { + if ($platform[0] != '!' && $platform != $os) { $release[$releaseNum]['filelist']['ignore'][] = array( 'attribs' => array( diff --git a/include/pear/PEAR/PackageFile/Generator/v2.php b/include/pear/PEAR/PackageFile/Generator/v2.php index b72a16d1..8a23748f 100644 --- a/include/pear/PEAR/PackageFile/Generator/v2.php +++ b/include/pear/PEAR/PackageFile/Generator/v2.php @@ -752,7 +752,7 @@ http://pear.php.net/dtd/package-2.0.xsd', } } - if (is_string($value) && $value && ($value{strlen($value) - 1} == "\n")) { + if (is_string($value) && $value && ($value[strlen($value) - 1] == "\n")) { $value .= str_repeat($this->options['indent'], $this->_tagDepth); } $tmp .= $this->_createXMLTag(array( @@ -1501,7 +1501,7 @@ class PEAR_PackageFile_Generator_v2_XML_Util { function isValidName($string) { // check for invalid chars - if (!preg_match("/^[[:alnum:]_\-.]$/", $string{0})) { + if (!preg_match("/^[[:alnum:]_\-.]$/", $string[0])) { return PEAR_PackageFile_Generator_v2_XML_Util::raiseError( "XML names may only start with letter or underscore", PEAR_PackageFile_Generator_v2_XML_Util_ERROR_INVALID_START ); } diff --git a/include/pear/PEAR/PackageFile/v1.php b/include/pear/PEAR/PackageFile/v1.php index 089ac1c8..2e42fa37 100644 --- a/include/pear/PEAR/PackageFile/v1.php +++ b/include/pear/PEAR/PackageFile/v1.php @@ -1192,7 +1192,7 @@ class PEAR_PackageFile_v1 $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE, array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles())); } - if ($file{0} == '.' && $file{1} == '/') { + if ($file[0] == '.' && $file[1] == '/') { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME, array('file' => $file)); } @@ -1573,7 +1573,7 @@ class PEAR_PackageFile_v1 foreach ($methods as $method) { $function = "$class::$method"; $key = "function;$function"; - if ($method{0} == '_' || !strcasecmp($method, $class) || + if ($method[0] == '_' || !strcasecmp($method, $class) || isset($this->_packageInfo['provides'][$key])) { continue; } @@ -1584,7 +1584,7 @@ class PEAR_PackageFile_v1 foreach ($srcinfo['declared_functions'] as $function) { $key = "function;$function"; - if ($function{0} == '_' || isset($this->_packageInfo['provides'][$key])) { + if ($function[0] == '_' || isset($this->_packageInfo['provides'][$key])) { continue; } if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) { diff --git a/include/pear/PEAR/PackageFile/v2/Validator.php b/include/pear/PEAR/PackageFile/v2/Validator.php index 8066a521..c48e0f3b 100644 --- a/include/pear/PEAR/PackageFile/v2/Validator.php +++ b/include/pear/PEAR/PackageFile/v2/Validator.php @@ -405,7 +405,7 @@ class PEAR_PackageFile_v2_Validator foreach ($tags as $i => $tag) { if (!is_array($tag) || !isset($tag['attribs'])) { foreach ($choice['attribs'] as $attrib) { - if ($attrib{0} != '?') { + if ($attrib[0] != '?') { $ret &= $this->_tagHasNoAttribs($choice['tag'], $context); continue 2; @@ -413,7 +413,7 @@ class PEAR_PackageFile_v2_Validator } } foreach ($choice['attribs'] as $attrib) { - if ($attrib{0} != '?') { + if ($attrib[0] != '?') { if (!isset($tag['attribs'][$attrib])) { $ret &= $this->_tagMissingAttribute($choice['tag'], $attrib, $context); @@ -435,9 +435,9 @@ class PEAR_PackageFile_v2_Validator } return $ret; } - $multi = $key{0}; + $multi = $key[0]; if ($multi == '+' || $multi == '*') { - $ret['multiple'] = $key{0}; + $ret['multiple'] = $key[0]; $key = substr($key, 1); } if (count($attrs = explode('->', $key)) > 1) { @@ -1025,8 +1025,8 @@ class PEAR_PackageFile_v2_Validator foreach ($list['file'] as $i => $file) { if (isset($file['attribs']) && isset($file['attribs']['name']) && - $file['attribs']['name']{0} == '.' && - $file['attribs']['name']{1} == '/') { + $file['attribs']['name'][0] == '.' && + $file['attribs']['name'][1] == '/') { // name is something like "./doc/whatever.txt" $this->_invalidFileName($file['attribs']['name']); } @@ -1973,7 +1973,7 @@ class PEAR_PackageFile_v2_Validator foreach ($methods as $method) { $function = "$class::$method"; $key = "function;$function"; - if ($method{0} == '_' || !strcasecmp($method, $class) || + if ($method[0] == '_' || !strcasecmp($method, $class) || isset($providesret[$key])) { continue; } @@ -1984,7 +1984,7 @@ class PEAR_PackageFile_v2_Validator foreach ($srcinfo['declared_functions'] as $function) { $key = "function;$function"; - if ($function{0} == '_' || isset($providesret[$key])) { + if ($function[0] == '_' || isset($providesret[$key])) { continue; } if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) { diff --git a/include/pear/PEAR/Registry.php b/include/pear/PEAR/Registry.php index 35460bde..fa346ecc 100644 --- a/include/pear/PEAR/Registry.php +++ b/include/pear/PEAR/Registry.php @@ -1066,7 +1066,7 @@ class PEAR_Registry extends PEAR return array('pear.php.net', 'pecl.php.net', '__uri'); } while ($ent = readdir($dp)) { - if ($ent{0} == '.' || substr($ent, -4) != '.reg') { + if ($ent[0] == '.' || substr($ent, -4) != '.reg') { continue; } if ($ent == '__uri.reg') { @@ -1102,7 +1102,7 @@ class PEAR_Registry extends PEAR return $pkglist; } while ($ent = readdir($dp)) { - if ($ent{0} == '.' || substr($ent, -4) != '.reg') { + if ($ent[0] == '.' || substr($ent, -4) != '.reg') { continue; } $pkglist[] = substr($ent, 0, -4); @@ -1122,7 +1122,7 @@ class PEAR_Registry extends PEAR return $pkglist; } while ($ent = readdir($dp)) { - if ($ent{0} == '.' || substr($ent, -4) != '.reg') { + if ($ent[0] == '.' || substr($ent, -4) != '.reg') { continue; } $pkglist[] = substr($ent, 0, -4); @@ -1977,7 +1977,7 @@ class PEAR_Registry extends PEAR } if (!isset($components['scheme'])) { if (strpos($components['path'], '/') !== false) { - if ($components['path']{0} == '/') { + if ($components['path'][0] == '/') { return PEAR::raiseError('parsePackageName(): this is not ' . 'a package name, it begins with "/" in "' . $param . '"', 'invalid', null, null, $param); diff --git a/include/pear/PEAR/Validate.php b/include/pear/PEAR/Validate.php index ed8adada..d93bb7cd 100644 --- a/include/pear/PEAR/Validate.php +++ b/include/pear/PEAR/Validate.php @@ -217,7 +217,7 @@ class PEAR_Validate } $vlen = strlen($test); $majver = substr($name, strlen($name) - $vlen); - while ($majver && !is_numeric($majver{0})) { + while ($majver && !is_numeric($majver[0])) { $majver = substr($majver, 1); } if ($majver != $test) { @@ -295,7 +295,7 @@ class PEAR_Validate } if (!$this->_packagexml->getExtends()) { if ($versioncomponents[0] == '1') { - if ($versioncomponents[2]{0} == '0') { + if ($versioncomponents[2][0] == '0') { if ($versioncomponents[2] == '0') { // version 1.*.0000 $this->_addWarning('version', @@ -336,7 +336,7 @@ class PEAR_Validate } else { $vlen = strlen($versioncomponents[0] . ''); $majver = substr($name, strlen($name) - $vlen); - while ($majver && !is_numeric($majver{0})) { + while ($majver && !is_numeric($majver[0])) { $majver = substr($majver, 1); } if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) { @@ -347,7 +347,7 @@ class PEAR_Validate return true; } if ($versioncomponents[0] == $majver) { - if ($versioncomponents[2]{0} == '0') { + if ($versioncomponents[2][0] == '0') { if ($versioncomponents[2] == '0') { // version 2.*.0000 $this->_addWarning('version', @@ -406,7 +406,7 @@ class PEAR_Validate if ($this->_packagexml->getExtends()) { $vlen = strlen($versioncomponents[0] . ''); $majver = substr($name, strlen($name) - $vlen); - while ($majver && !is_numeric($majver{0})) { + while ($majver && !is_numeric($majver[0])) { $majver = substr($majver, 1); } if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) { diff --git a/include/pear/System.php b/include/pear/System.php index 8a2f22f3..f8d1fbb3 100644 --- a/include/pear/System.php +++ b/include/pear/System.php @@ -235,7 +235,7 @@ class System } elseif($opt[0] == 'm') { // if the mode is clearly an octal number (starts with 0) // convert it to decimal - if (strlen($opt[1]) && $opt[1]{0} == '0') { + if (strlen($opt[1]) && $opt[1][0] == '0') { $opt[1] = octdec($opt[1]); } else { // convert to int @@ -545,7 +545,7 @@ class System break; case '-name': if (OS_WINDOWS) { - if ($args[$i+1]{0} == '\\') { + if ($args[$i+1][0] == '\\') { // prepend drive $args[$i+1] = addslashes(substr(getcwd(), 0, 2) . $args[$i + 1]); } diff --git a/include/sha256.php b/include/sha256.php index 3af72d4b..9ec1e8ed 100644 --- a/include/sha256.php +++ b/include/sha256.php @@ -254,17 +254,17 @@ class SHA256 extends hash { // initialize the registers for($j = 0; $j < 8; $j++) - ${$vars{$j}} = $hashData->hash[$j]; + ${$vars[$j]} = $hashData->hash[$j]; // the SHA-256 compression function for($j = 0; $j < 64; $j++) { if($j < 16) { - $T1 = ord($hashData->chunks[$i]{$j*4 }) & 0xFF; $T1 <<= 8; - $T1 |= ord($hashData->chunks[$i]{$j*4+1}) & 0xFF; $T1 <<= 8; - $T1 |= ord($hashData->chunks[$i]{$j*4+2}) & 0xFF; $T1 <<= 8; - $T1 |= ord($hashData->chunks[$i]{$j*4+3}) & 0xFF; + $T1 = ord($hashData->chunks[$i][$j*4 ]) & 0xFF; $T1 <<= 8; + $T1 |= ord($hashData->chunks[$i][$j*4+1]) & 0xFF; $T1 <<= 8; + $T1 |= ord($hashData->chunks[$i][$j*4+2]) & 0xFF; $T1 <<= 8; + $T1 |= ord($hashData->chunks[$i][$j*4+3]) & 0xFF; $W[$j] = $T1; } else @@ -286,7 +286,7 @@ class SHA256 extends hash // compute the next hash set for($j = 0; $j < 8; $j++) - $hashData->hash[$j] = SHA256::sum(${$vars{$j}}, $hashData->hash[$j]); + $hashData->hash[$j] = SHA256::sum(${$vars[$j]}, $hashData->hash[$j]); } } @@ -351,7 +351,7 @@ function hexerize($str) $o = 'string(' . strlen($str) . ')' . "::\n"; for($i = 0, $j = strlen($str); $i < $j; $i++, $b = $i % 4) { - $o .= sprintf('%02X', ord($str{$i})); + $o .= sprintf('%02X', ord($str[$i])); // only process when 32-bits have passed through if($i != 0 && $b == 3) {