Skip to content

Commit

Permalink
Dev: Remove {} array/string access
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt authored and eddylackmann committed Jan 27, 2020
1 parent c8c8630 commit 8dbc4a5
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion application/libraries/simpletester.php
Expand Up @@ -135,7 +135,7 @@ public function Run()
*/
class ShowPasses extends HtmlReporter
{
function ShowPasses()
function __construct()
{
$this->HtmlReporter();
}
Expand Down
4 changes: 2 additions & 2 deletions application/third_party/Twig/Node.php
Expand Up @@ -39,7 +39,7 @@ public function __construct(array $nodes = array(), array $attributes = array(),
{
foreach ($nodes as $name => $node) {
if (!$node instanceof Twig_NodeInterface) {
@trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
@trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : (null === $node ? 'null' : gettype($node)), $name, get_class($this)), E_USER_DEPRECATED);
}
}
$this->nodes = $nodes;
Expand Down Expand Up @@ -195,7 +195,7 @@ public function getNode($name)
public function setNode($name, $node = null)
{
if (!$node instanceof Twig_NodeInterface) {
@trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
@trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : (null === $node ? 'null' : gettype($node)), $name, get_class($this)), E_USER_DEPRECATED);
}

$this->nodes[$name] = $node;
Expand Down
10 changes: 5 additions & 5 deletions application/third_party/idna-convert/idna_convert.class.php
Expand Up @@ -418,7 +418,7 @@ protected function _decode($encoded)
$delim_pos = strrpos($encoded, '-');
if ($delim_pos > self::byteLength($this->_punycode_prefix)) {
for ($k = self::byteLength($this->_punycode_prefix); $k < $delim_pos; ++$k) {
$decoded[] = ord($encoded{$k});
$decoded[] = ord($encoded[$k]);
}
}
$deco_len = count($decoded);
Expand All @@ -432,7 +432,7 @@ protected function _decode($encoded)

for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) {
$digit = $this->_decode_digit($encoded{$enco_idx++});
$digit = $this->_decode_digit($encoded[$enco_idx++]);
$idx += $digit * $w;
$t = ($k <= $bias) ? $this->_tmin :
(($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
Expand Down Expand Up @@ -826,7 +826,7 @@ protected function _utf8_to_ucs4($input)
$mode = 'next';
$test = 'none';
for ($k = 0; $k < $inp_len; ++$k) {
$v = ord($input{$k}); // Extract byte from input string
$v = ord($input[$k]); // Extract byte from input string
if ($v < 128) { // We found an ASCII char - put into stirng as is
$output[$out_len] = $v;
++$out_len;
Expand Down Expand Up @@ -955,7 +955,7 @@ protected function _ucs4_string_to_ucs4($input)
$out_len++;
$output[$out_len] = 0;
}
$output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
$output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) );
}
return $output;
}
Expand Down Expand Up @@ -1603,4 +1603,4 @@ public function singleton($params = array())
)
);
}
?>
?>
6 changes: 3 additions & 3 deletions application/third_party/idna-convert/transcode_wrapper.php
Expand Up @@ -92,7 +92,7 @@ function map_w1252_iso8859_1($string = '')
if ($string == '') return '';
$return = '';
for ($i = 0; $i < strlen($string); ++$i) {
$c = ord($string{$i});
$c = ord($string[$i]);
switch ($c) {
case 129: $return .= chr(252); break;
case 132: $return .= chr(228); break;
Expand All @@ -119,7 +119,7 @@ function map_iso8859_1_w1252($string = '')
if ($string == '') return '';
$return = '';
for ($i = 0; $i < strlen($string); ++$i) {
$c = ord($string{$i});
$c = ord($string[$i]);
switch ($c) {
case 196: $return .= chr(142); break;
case 214: $return .= chr(153); break;
Expand All @@ -134,4 +134,4 @@ function map_iso8859_1_w1252($string = '')
return $return;
}

?>
?>
12 changes: 6 additions & 6 deletions application/third_party/idna-convert/uctc.php
Expand Up @@ -59,7 +59,7 @@ private static function utf8_ucs4array($input)
$mode = 'next';
$test = 'none';
for ($k = 0; $k < $inp_len; ++$k) {
$v = ord($input{$k}); // Extract byte from input string
$v = ord($input[$k]); // Extract byte from input string

if ($v < 128) { // We found an ASCII char - put into stirng as is
$output[$out_len] = $v;
Expand Down Expand Up @@ -176,7 +176,7 @@ private static function utf7_ucs4array($input, $sc = '+')
$b64 = '';

for ($k = 0; $k < $inp_len; ++$k) {
$c = $input{$k};
$c = $input[$k];
if (0 == ord($c)) continue; // Ignore zero bytes
if ('b' == $mode) {
// Sequence got terminated
Expand All @@ -193,10 +193,10 @@ private static function utf7_ucs4array($input, $sc = '+')
$tmp = substr($tmp, -1 * (strlen($tmp) % 2));
for ($i = 0; $i < strlen($tmp); $i++) {
if ($i % 2) {
$output[$out_len] += ord($tmp{$i});
$output[$out_len] += ord($tmp[$i]);
$out_len++;
} else {
$output[$out_len] = ord($tmp{$i}) << 8;
$output[$out_len] = ord($tmp[$i]) << 8;
}
}
$mode = 'd';
Expand Down Expand Up @@ -292,9 +292,9 @@ private static function ucs4_ucs4array($input)
$out_len++;
$output[$out_len] = 0;
}
$output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
$output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) );
}
return $output;
}
}
?>
?>
6 changes: 3 additions & 3 deletions application/third_party/pear/OLE/OLE.php
Expand Up @@ -311,7 +311,7 @@ static function Asc2Ucs($ascii)
{
$rawname = '';
for ($i = 0; $i < strlen($ascii); $i++) {
$rawname .= $ascii{$i}."\x00";
$rawname .= $ascii[$i]."\x00";
}
return $rawname;
}
Expand Down Expand Up @@ -383,7 +383,7 @@ static function OLE2LocalDate($string)
$high_part = 0;
for ($i=0; $i<4; $i++)
{
$al = unpack('C', $string{(7 - $i)});
$al = unpack('C', $string[(7 - $i)]);
$high_part += $al[''];
if ($i < 3) {
$high_part *= 0x100;
Expand All @@ -392,7 +392,7 @@ static function OLE2LocalDate($string)
$low_part = 0;
for ($i=4; $i<8; $i++)
{
$al = unpack('C', $string{(7 - $i)});
$al = unpack('C', $string[(7 - $i)]);
$low_part += $al[''];
if ($i < 7) {
$low_part *= 0x100;
Expand Down
16 changes: 8 additions & 8 deletions application/third_party/pear/Spreadsheet/Excel/Writer/Parser.php
Expand Up @@ -1091,7 +1091,7 @@ protected function _cellToRowcol($cell)
$col = 0;
$col_ref_length = strlen($col_ref);
for ($i = 0; $i < $col_ref_length; $i++) {
$col += (ord($col_ref{$i}) - ord('A') + 1) * pow(26, $expn);
$col += (ord($col_ref[$i]) - ord('A') + 1) * pow(26, $expn);
$expn--;
}

Expand All @@ -1113,20 +1113,20 @@ protected function _advance()
$formula_length = strlen($this->_formula);
// eat up white spaces
if ($i < $formula_length) {
while ($this->_formula{$i} == " ") {
while ($this->_formula[$i] == " ") {
$i++;
}

if ($i < ($formula_length - 1)) {
$this->_lookahead = $this->_formula{$i+1};
$this->_lookahead = $this->_formula[$i+1];
}
$token = '';
}

while ($i < $formula_length) {
$token .= $this->_formula{$i};
$token .= $this->_formula[$i];
if ($i < ($formula_length - 1)) {
$this->_lookahead = $this->_formula{$i+1};
$this->_lookahead = $this->_formula[$i+1];
} else {
$this->_lookahead = '';
}
Expand All @@ -1141,7 +1141,7 @@ protected function _advance()
}

if ($i < ($formula_length - 2)) {
$this->_lookahead = $this->_formula{$i+2};
$this->_lookahead = $this->_formula[$i+2];
} else { // if we run out of characters _lookahead becomes empty
$this->_lookahead = '';
}
Expand Down Expand Up @@ -1292,7 +1292,7 @@ public function parse($formula)
{
$this->_current_char = 0;
$this->_formula = $formula;
$this->_lookahead = $formula{1};
$this->_lookahead = $formula[1];
$this->_advance();
$this->_parse_tree = $this->_condition();
if (PEAR::isError($this->_parse_tree)) {
Expand Down Expand Up @@ -1701,4 +1701,4 @@ public function toReversePolish($tree = array())
$polish .= $converted_tree;
return $polish;
}
}
}
Expand Up @@ -629,7 +629,7 @@ protected function lookAheadTest($data, $pos, $mode) {
if ($numch[ENC_C40] == $numch[ENC_X12]) {
$k = ($pos + $charscount + 1);
while ($k < $data_length) {
$tmpchr = ord($data{$k});
$tmpchr = ord($data[$k]);
if ($this->isCharMode($tmpchr, ENC_X12)) {
return ENC_X12;
} elseif (!($this->isCharMode($tmpchr, ENC_X12) OR $this->isCharMode($tmpchr, ENC_C40))) {
Expand Down
6 changes: 3 additions & 3 deletions application/third_party/tcpdf/include/barcodes/pdf417.php
Expand Up @@ -878,7 +878,7 @@ protected function getCompaction($mode, $code, $addmode=true) {
$txtarr = array(); // array of characters and sub-mode switching characters
$codelen = strlen($code);
for ($i = 0; $i < $codelen; ++$i) {
$chval = ord($code{$i});
$chval = ord($code[$i]);
if (($k = array_search($chval, $this->textsubmodes[$submode])) !== false) {
// we are on the same sub-mode
$txtarr[] = $k;
Expand All @@ -888,7 +888,7 @@ protected function getCompaction($mode, $code, $addmode=true) {
// search new sub-mode
if (($s != $submode) AND (($k = array_search($chval, $this->textsubmodes[$s])) !== false)) {
// $s is the new submode
if (((($i + 1) == $codelen) OR ((($i + 1) < $codelen) AND (array_search(ord($code{($i + 1)}), $this->textsubmodes[$submode]) !== false))) AND (($s == 3) OR (($s == 0) AND ($submode == 1)))) {
if (((($i + 1) == $codelen) OR ((($i + 1) < $codelen) AND (array_search(ord($code[($i + 1)]), $this->textsubmodes[$submode]) !== false))) AND (($s == 3) OR (($s == 0) AND ($submode == 1)))) {
// shift (temporary change only for this char)
if ($s == 3) {
// shift to puntuaction
Expand Down Expand Up @@ -952,7 +952,7 @@ protected function getCompaction($mode, $code, $addmode=true) {
$cw = array_merge($cw, $cw6);
} else {
for ($i = 0; $i < $sublen; ++$i) {
$cw[] = ord($code{$i});
$cw[] = ord($code[$i]);
}
}
$code = $rest;
Expand Down
6 changes: 3 additions & 3 deletions application/third_party/tcpdf/include/tcpdf_filters.php
Expand Up @@ -279,7 +279,7 @@ public static function decodeFilterLZWDecode($data) {
// convert string to binary string
$bitstring = '';
for ($i = 0; $i < $data_length; ++$i) {
$bitstring .= sprintf('%08b', ord($data{$i}));
$bitstring .= sprintf('%08b', ord($data[$i]));
}
// get the number of bits
$data_length = strlen($bitstring);
Expand Down Expand Up @@ -376,7 +376,7 @@ public static function decodeFilterRunLengthDecode($data) {
$i = 0;
while($i < $data_length) {
// get current byte value
$byte = ord($data{$i});
$byte = ord($data[$i]);
if ($byte == 128) {
// a length value of 128 denote EOD
break;
Expand All @@ -389,7 +389,7 @@ public static function decodeFilterRunLengthDecode($data) {
} else {
// if length is in the range 129 to 255,
// the following single byte shall be copied 257 - length (2 to 128) times during decompression
$decoded .= str_repeat($data{($i + 1)}, (257 - $byte));
$decoded .= str_repeat($data[($i + 1)], (257 - $byte));
// move to next block
$i += 2;
}
Expand Down
2 changes: 1 addition & 1 deletion application/third_party/tcpdf/include/tcpdf_images.php
Expand Up @@ -311,7 +311,7 @@ public static function _parsepng($file) {
if ($n > 0) {
$trns = array();
for ($i = 0; $i < $n; ++ $i) {
$trns[] = ord($t{$i});
$trns[] = ord($t[$i]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/third_party/tcpdf/tcpdf.php
Expand Up @@ -16897,7 +16897,7 @@ protected function getHtmlDomArray($html) {
if (($dom[$key]['value'] == 'pre') OR ($dom[$key]['value'] == 'tt')) {
$dom[$key]['fontname'] = $this->default_monospaced_font;
}
if (!empty($dom[$key]['value']) AND ($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value']{1}) > 0) AND (intval($dom[$key]['value']{1}) < 7)) {
if (!empty($dom[$key]['value']) AND ($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]) < 7)) {
// headings h1, h2, h3, h4, h5, h6
if (!isset($dom[$key]['attribute']['size']) AND !isset($dom[$key]['style']['font-size'])) {
$headsize = (4 - intval($dom[$key]['value']{1})) * 2;
Expand Down

0 comments on commit 8dbc4a5

Please sign in to comment.