PHP8 compatibility: replaced the curly brackets {} with square brackets [] where used in combination with strings

This commit is contained in:
Paolo
2025-11-19 10:53:59 +01:00
parent e4a7955239
commit e837101651
6 changed files with 17 additions and 17 deletions
@@ -233,10 +233,10 @@ class Person extends API_Controller
//Quersumme bilden //Quersumme bilden
for ($i = 0; $i < 10; $i++) for ($i = 0; $i < 10; $i++)
{ {
$erg += $gewichtung[$i] * $tmpSvnr{$i}; $erg += $gewichtung[$i] * $tmpSvnr[$i];
} }
if ($tmpSvnr{3} != ($erg % 11)) //Vergleichen der Pruefziffer mit Quersumme Modulo 11 if ($tmpSvnr[3] != ($erg % 11)) //Vergleichen der Pruefziffer mit Quersumme Modulo 11
{ {
return error('SVNR ist ungueltig'); return error('SVNR ist ungueltig');
} }
@@ -244,7 +244,7 @@ class Person extends API_Controller
if (mb_strlen($person['svnr']) == 12) if (mb_strlen($person['svnr']) == 12)
{ {
$last = substr($person['svnr'], 10, 12); $last = substr($person['svnr'], 10, 12);
if ($last{0} != 'v' || !is_numeric($last{1})) if ($last[0] != 'v' || !is_numeric($last[1]))
{ {
return error('SVNR ist ungueltig'); return error('SVNR ist ungueltig');
} }
+6 -6
View File
@@ -178,7 +178,7 @@ class File_CSV
return $field; return $field;
} }
if ($quote && $field{0} == $quote && $field{strlen($field)-1} == $quote) { if ($quote && $field[0] == $quote && $field[strlen($field) - 1] == $quote) {
return substr($field, 1, -1); return substr($field, 1, -1);
} }
return $field; return $field;
@@ -230,7 +230,7 @@ class File_CSV
} elseif ($c == "\n" || $c == "\r") { } elseif ($c == "\n" || $c == "\r") {
$sub = ($prev == "\r") ? 2 : 1; $sub = ($prev == "\r") ? 2 : 1;
if ((strlen($buff) >= $sub) && if ((strlen($buff) >= $sub) &&
($buff{strlen($buff) - $sub} == $quote)) ($buff[strlen($buff) - $sub] == $quote))
{ {
$in_quote = false; $in_quote = false;
} }
@@ -312,9 +312,9 @@ class File_CSV
$last =& $fields[count($fields) - 1]; $last =& $fields[count($fields) - 1];
// Fallback to read the line with readQuoted when guess // Fallback to read the line with readQuoted when guess
// that the simple explode won't work right // that the simple explode won't work right
if (($last{strlen($last) - 1} == "\n" if (($last[strlen($last) - 1] == "\n"
&& $last{0} == $conf['quote'] && $last[0] == $conf['quote']
&& $last{strlen(rtrim($last)) - 1} != $conf['quote']) && $last[strlen(rtrim($last)) - 1] != $conf['quote'])
|| ||
(count($fields) != $conf['fields']) (count($fields) != $conf['fields'])
// XXX perhaps there is a separator inside a quoted field // XXX perhaps there is a separator inside a quoted field
@@ -511,4 +511,4 @@ class File_CSV
return true; return true;
} }
} }
?> ?>
+5 -5
View File
@@ -96,7 +96,7 @@ class File_Util
{ {
if (File_Util::isAbsolute($path)) { if (File_Util::isAbsolute($path)) {
if (FILE_WIN32) { if (FILE_WIN32) {
return substr($path, $path{3} == '\\' ? 4 : 3); return substr($path, $path[3] == '\\' ? 4 : 3);
} }
return ltrim($path, '/'); return ltrim($path, '/');
} }
@@ -182,7 +182,7 @@ class File_Util
if (FILE_WIN32) { if (FILE_WIN32) {
return preg_match('/^[a-zA-Z]:(\\\|\/)/', $path); return preg_match('/^[a-zA-Z]:(\\\|\/)/', $path);
} }
return ($path{0} == '/') || ($path{0} == '~'); return ($path[0] == '/') || ($path[0] == '~');
} }
/** /**
@@ -244,11 +244,11 @@ class File_Util
} else { } else {
$cwd = getcwd(); $cwd = getcwd();
$drive = substr($cwd, 0, 2); $drive = substr($cwd, 0, 2);
if ($path{0} !== $separator{0}) { if ($path[0] !== $separator[0]) {
$path = substr($cwd, 3) . $separator . $path; $path = substr($cwd, 3) . $separator . $path;
} }
} }
} elseif ($path{0} !== $separator) { } elseif ($path[0] !== $separator) {
$path = getcwd() . $separator . $path; $path = getcwd() . $separator . $path;
} }
@@ -323,7 +323,7 @@ class File_Util
$entries = array(); $entries = array();
for ($dir = dir($path); false !== $entry = $dir->read(); ) { for ($dir = dir($path); false !== $entry = $dir->read(); ) {
if ($list & FILE_LIST_DOTS || $entry{0} !== '.') { if ($list & FILE_LIST_DOTS || $entry[0] !== '.') {
$isRef = ($entry === '.' || $entry === '..'); $isRef = ($entry === '.' || $entry === '..');
$isDir = $isRef || is_dir($path .'/'. $entry); $isDir = $isRef || is_dir($path .'/'. $entry);
if ( ((!$isDir && $list & FILE_LIST_FILES) || if ( ((!$isDir && $list & FILE_LIST_FILES) ||
+1 -1
View File
@@ -240,7 +240,7 @@ class filter extends basis_db
{ {
//$value->value = preg_replace('/(.*?)selected=.selected./', '$1', $value->value); //$value->value = preg_replace('/(.*?)selected=.selected./', '$1', $value->value);
//$value->value = preg_replace('/(.*?)\s*[selected=?selected?]/', '$1', $value->value); //$value->value = preg_replace('/(.*?)\s*[selected=?selected?]/', '$1', $value->value);
//$value->value = preg_replace('/(.*?)\s*selected="selected"\s*/', '${1}', $value->value); //$value->value = preg_replace('/(.*?)\s*selected="selected"\s*/', '$[1]', $value->value);
//$value->value = preg_replace('/^\s*selected=.*?selected.*?\s*/', ' ', $value->value); //$value->value = preg_replace('/^\s*selected=.*?selected.*?\s*/', ' ', $value->value);
//$value->value = str_replace('selected=', '', $value->value); //$value->value = str_replace('selected=', '', $value->value);
+1 -1
View File
@@ -1532,7 +1532,7 @@ class WavFile
} else { } else {
// replace // replace
for ($i = 0; $i < $sampleBytes; ++$i) { for ($i = 0; $i < $sampleBytes; ++$i) {
$this->_samples{$offset + $i} = $sampleBinary{$i}; $this->_samples[$offset + $i] = $sampleBinary[$i];
} }
} }
+1 -1
View File
@@ -1435,7 +1435,7 @@ class Securimage
$length = strlen($code['display']); $length = strlen($code['display']);
for($i = 0; $i < $length; ++$i) { for($i = 0; $i < $length; ++$i) {
$letter = $code['display']{$i}; $letter = $code['display'][$i];
$letters[] = $letter; $letters[] = $letter;
} }
} }