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
+6 -6
View File
@@ -178,7 +178,7 @@ class File_CSV
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 $field;
@@ -230,7 +230,7 @@ class File_CSV
} elseif ($c == "\n" || $c == "\r") {
$sub = ($prev == "\r") ? 2 : 1;
if ((strlen($buff) >= $sub) &&
($buff{strlen($buff) - $sub} == $quote))
($buff[strlen($buff) - $sub] == $quote))
{
$in_quote = false;
}
@@ -312,9 +312,9 @@ class File_CSV
$last =& $fields[count($fields) - 1];
// Fallback to read the line with readQuoted when guess
// that the simple explode won't work right
if (($last{strlen($last) - 1} == "\n"
&& $last{0} == $conf['quote']
&& $last{strlen(rtrim($last)) - 1} != $conf['quote'])
if (($last[strlen($last) - 1] == "\n"
&& $last[0] == $conf['quote']
&& $last[strlen(rtrim($last)) - 1] != $conf['quote'])
||
(count($fields) != $conf['fields'])
// XXX perhaps there is a separator inside a quoted field
@@ -511,4 +511,4 @@ class File_CSV
return true;
}
}
?>
?>
+5 -5
View File
@@ -96,7 +96,7 @@ class File_Util
{
if (File_Util::isAbsolute($path)) {
if (FILE_WIN32) {
return substr($path, $path{3} == '\\' ? 4 : 3);
return substr($path, $path[3] == '\\' ? 4 : 3);
}
return ltrim($path, '/');
}
@@ -182,7 +182,7 @@ class File_Util
if (FILE_WIN32) {
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 {
$cwd = getcwd();
$drive = substr($cwd, 0, 2);
if ($path{0} !== $separator{0}) {
if ($path[0] !== $separator[0]) {
$path = substr($cwd, 3) . $separator . $path;
}
}
} elseif ($path{0} !== $separator) {
} elseif ($path[0] !== $separator) {
$path = getcwd() . $separator . $path;
}
@@ -323,7 +323,7 @@ class File_Util
$entries = array();
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 === '..');
$isDir = $isRef || is_dir($path .'/'. $entry);
if ( ((!$isDir && $list & FILE_LIST_FILES) ||