From 5918ff8d0ddbaf5b7086bd051f2786ceb1ed6065 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 25 Mar 2021 14:33:38 +0100 Subject: Fix deprecated curly braces string indexing (PHP 7.4) --- modules-available/sysconfig/addmodule_adauth.inc.php | 2 +- .../sysconfig/addmodule_branding.inc.php | 4 ++-- .../sysconfig/addmodule_ldapauth.inc.php | 2 +- modules-available/sysconfig/inc/ppd.inc.php | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'modules-available/sysconfig') diff --git a/modules-available/sysconfig/addmodule_adauth.inc.php b/modules-available/sysconfig/addmodule_adauth.inc.php index f2ac206e..9f2a86f6 100644 --- a/modules-available/sysconfig/addmodule_adauth.inc.php +++ b/modules-available/sysconfig/addmodule_adauth.inc.php @@ -448,7 +448,7 @@ class AdAuth_HomeDir extends AddModule_Base foreach (range('D', 'Z') as $l) { $data['drives'][] = array( 'drive' => $l . ':', - 'selected' => (strtoupper($letter{0}) === $l) ? 'selected="selected"' : '' + 'selected' => (strtoupper($letter[0]) === $l) ? 'selected="selected"' : '' ); } Render::addDialog(Dictionary::translateFile('config-module', 'adAuth_title'), false, 'ad_ldap-homedir', $data); diff --git a/modules-available/sysconfig/addmodule_branding.inc.php b/modules-available/sysconfig/addmodule_branding.inc.php index d941a7a7..22c42f54 100644 --- a/modules-available/sysconfig/addmodule_branding.inc.php +++ b/modules-available/sysconfig/addmodule_branding.inc.php @@ -154,8 +154,8 @@ class Branding_ProcessFile extends AddModule_Base $parsed = parse_url($absolute); $path = dirname($parsed['path']); - if ($relative{0} === '/') { - if ($relative{1} === '/') + if ($relative[0] === '/') { + if ($relative[1] === '/') return "{$parsed['scheme']}:$relative"; $cparts = array_filter(explode("/", $relative)); } else { diff --git a/modules-available/sysconfig/addmodule_ldapauth.inc.php b/modules-available/sysconfig/addmodule_ldapauth.inc.php index 606ce381..88007f0c 100644 --- a/modules-available/sysconfig/addmodule_ldapauth.inc.php +++ b/modules-available/sysconfig/addmodule_ldapauth.inc.php @@ -219,7 +219,7 @@ class LdapAuth_HomeDir extends AddModule_Base foreach (range('D', 'Z') as $l) { $data['drives'][] = array( 'drive' => $l . ':', - 'selected' => (strtoupper($letter{0}) === $l) ? 'selected="selected"' : '' + 'selected' => (strtoupper($letter[0]) === $l) ? 'selected="selected"' : '' ); } Render::addDialog(Dictionary::translateFile('config-module', 'ldapAuth_title'), false, 'ad_ldap-homedir', $data); diff --git a/modules-available/sysconfig/inc/ppd.inc.php b/modules-available/sysconfig/inc/ppd.inc.php index 9bd5d171..e48f1652 100644 --- a/modules-available/sysconfig/inc/ppd.inc.php +++ b/modules-available/sysconfig/inc/ppd.inc.php @@ -320,7 +320,7 @@ class Ppd $no = 0; while ($lStart < $this->dataLen && $lEnd !== false) { unset($mainKeyword, $optionKeyword, $optionTranslation, $option, $value, $valueTranslation); - if ($no !== 0 && $this->data{$lEnd} === "\r" && $this->data{$lEnd + 1} === "\n") { + if ($no !== 0 && $this->data[$lEnd] === "\r" && $this->data[$lEnd + 1] === "\n") { $lEnd++; } if ($no === 1) { @@ -373,8 +373,8 @@ class Ppd } } // 3) Handle "key [option]: value" - if ($line{0} === '*') { - if ($line{1} === '%') { + if ($line[0] === '*') { + if ($line[1] === '%') { // Skip comment continue; } @@ -394,7 +394,7 @@ class Ppd $optionTranslation = isset($out[4]) ? $this->unhexTranslation($no, substr($out[4], 1)) : $optionKeyword; // If no translation given, fallback to option // 3b) Handle value $value = $parts[1]; - if ($value{0} === '"') { + if ($value[0] === '"') { // Start of InvocationValue or QuotedValue if (preg_match(',^"([^"]*)"(/.*)?$,', $value, $vMatch)) { // Single line @@ -459,7 +459,7 @@ class Ppd $this->error = 'Line ' . $no . ': ' . $mainKeyword . ' with no option keyword'; return; } - if ($optionKeyword{0} !== '*') { + if ($optionKeyword[0] !== '*') { $this->error = 'Line ' . $no . ': ' . $mainKeyword . " with option keyword that doesn't start with asterisk (*)."; return; } @@ -569,7 +569,7 @@ class Ppd $option = $this->getOption($optionKeyword, $currentBlock); $option->customParam = new PpdOption($lStart, $len, $value, $valueTranslation); } - } elseif ($mainKeyword{0} === '?') { + } elseif ($mainKeyword[0] === '?') { // Ignoring option query for now } elseif ($optionKeyword === false && !isset($this->KNOWN_KEYWORDS[$mainKeyword])) { // Must be a definition for an option @@ -674,7 +674,7 @@ class Ppd if ($start >= $this->dataLen) return false; while ($start < $this->dataLen) { - $char = $this->data{$start}; + $char = $this->data[$start]; if ($char === "\r" || $char === "\n") return $start; ++$start; @@ -853,10 +853,10 @@ class Ppd foreach ($ranges as $range) { $new .= substr($this->data, $last, $range[0] - $last); $last = $range[1]; - if ($this->data{$last} === "\r") { + if ($this->data[$last] === "\r") { $last++; } - if ($this->data{$last} === "\n") { + if ($this->data[$last] === "\n") { $last++; } } @@ -882,7 +882,7 @@ class Ppd $pos = $setting->default->lineOffset; } elseif ($setting->block !== false && $setting->block->isUi()) { $pos = $this->nextLineEnd($setting->block->start); - while ($pos !== false && $pos < $this->dataLen && ($this->data{$pos} === "\r" || $this->data{$pos} === "\n")) { + while ($pos !== false && $pos < $this->dataLen && ($this->data[$pos] === "\r" || $this->data[$pos] === "\n")) { $pos++; } } -- cgit v1.2.3-55-g7522