PHP Deprecated: Array and string offset access syntax with curly braces is deprecated

This commit is contained in:
2022-06-14 16:33:31 +02:00
parent 42766d07a5
commit a60db30785
8 changed files with 24 additions and 24 deletions

View File

@@ -44,7 +44,7 @@ class Authhtpasswd extends Auth
foreach ($lines as $line)
{
// Comment line : skip it
if (isset ($line{0}) && $line{0} === "#")
if (isset ($line[0]) && $line[0] === "#")
continue;
$line = trim ($line);
$user = strstr ($line, ":", true);

View File

@@ -167,7 +167,7 @@ class Authzgroups
if ($object === null || ! is_string ($object))
throw new \Exception ("Object not provided to authzgroups\\accessRight",
500);
if ($object{0} !== "/")
if ($object[0] !== "/")
$object = "/$object";
$rc = $this->allow ($module, $user, "$object");
if ($this->debug)
@@ -202,7 +202,7 @@ class Authzgroups
if ($object === null || ! is_string ($object))
throw new \Exception ("Object not provided to authzgroups\\accessWrite",
500);
if ($object{0} !== "/")
if ($object[0] !== "/")
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)
@@ -239,7 +239,7 @@ class Authzgroups
if ($object === null || ! is_string ($object))
throw new \Exception ("Object not provided to authzgroups\\accessReadOnly",
500);
if ($object{0} !== "/")
if ($object[0] !== "/")
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)

View File

@@ -188,7 +188,7 @@ class Authzgroupsoo
if ($object === null || ! is_string ($object))
throw new \Exception ("Object not provided to authzgroups\\accessRight",
500);
if ($object{0} !== "/")
if ($object[0] !== "/")
$object = "/$object";
$rc = $this->allow ($module, $user, "$object");
if ($this->debug)
@@ -223,7 +223,7 @@ class Authzgroupsoo
if ($object === null || ! is_string ($object))
throw new \Exception ("Object not provided to authzgroups\\accessWrite",
500);
if ($object{0} !== "/")
if ($object[0] !== "/")
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)
@@ -260,7 +260,7 @@ class Authzgroupsoo
if ($object === null || ! is_string ($object))
throw new \Exception (
"Object not provided to authzgroups\\accessReadOnly", 500);
if ($object{0} !== "/")
if ($object[0] !== "/")
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)

View File

@@ -496,7 +496,7 @@ class Console
$this->moveCursor ($cursorPos);
}
// }}}
elseif (ord ($char{0}) === 27)
elseif (ord ($char[0]) === 27)
{
// ESC SEQUENCE
$sequence = "";
@@ -1014,9 +1014,9 @@ class Console
while ($token)
{
// find double quoted tokens
if ($token{0}=='"') { $token .= ' '.strtok('"').'"'; }
if ($token[0]=='"') { $token .= ' '.strtok('"').'"'; }
// find single quoted tokens
if ($token{0}=="'") { $token .= ' '.strtok("'")."'"; }
if ($token[0]=="'") { $token .= ' '.strtok("'")."'"; }
$tokens[] = $token;
$token = strtok(' ');
}

View File

@@ -571,7 +571,7 @@ class Httpclient
if ($i > 0)
$path .= "&";
$path .= rawurlencode ($key)."=";
if (isset ($val{0}) && $val{0} === "@")
if (isset ($val[0]) && $val[0] === "@")
{
$file = substr ($val, 1);
if (! file_exists ($file))
@@ -624,7 +624,7 @@ class Httpclient
if ($len > 0)
$len++; // Add the &
$len += strlen (rawurlencode ($key)) + 1;
if (isset ($val{0}) && $val{0} === "@")
if (isset ($val[0]) && $val[0] === "@")
{
$file = substr ($val, 1);
if (! file_exists ($file))
@@ -685,7 +685,7 @@ class Httpclient
}
$this->tcpclient->send (rawurlencode ($key)."=");
$this->log (3, rawurlencode ($key)."=");
if (isset ($val{0}) && $val{0} === "@")
if (isset ($val[0]) && $val[0] === "@")
{
$file = substr ($val, 1);
if (! file_exists ($file))
@@ -825,7 +825,7 @@ class Httpclient
$location = $this->headersReceived["Location"];
$parseURLInit = parse_url ($url);
$parseURLLocation = parse_url ($location);
if ($parseURLLocation["path"]{0} !== "/" &&
if ($parseURLLocation["path"][0] !== "/" &&
key_exists ("path", $parseURLInit))
$location = dirname ($parseURLInit["path"]).$location;
if (! key_exists ("port", $parseURLLocation) &&
@@ -1086,7 +1086,7 @@ class Httpclient
return array ();
if (! key_exists ("path", $parseURL))
$parseURL["path"] = "/";
if ($parseURL["path"]{0} !== "/")
if ($parseURL["path"][0] !== "/")
$parseURL["path"] = "/".$parseURL["path"];
$res = array ();
foreach ($this->cookies as $storedCookie)

View File

@@ -374,7 +374,7 @@ class Mail
$headersSplit[$i+1] = $headerBodySeparator;
if ($h === "" || $h === "--")
continue;
if ($h{0} === " " || $h{0} === "\t")
if ($h[0] === " " || $h[0] === "\t")
{
$prev .= $prevCR.$h;
$prevCR = $headersSplit[$i+1];
@@ -952,7 +952,7 @@ class Mail
$part = $this->sectionGet ($attachmentIDs[$number]);
foreach ($part as $key=>$val)
{
if ($key{0} === "_")
if ($key[0] === "_")
{
if ($key !== "_contentEML" && $key !== "_contentUTF" &&
$key !== "_parentID" && $key !== "_headersArray" &&
@@ -1671,7 +1671,7 @@ class Mail
$res["Content-Type"] = $key;
else
{
if ($val{0} === "'" || $val{0} === "\"")
if ($val[0] === "'" || $val[0] === "\"")
$val = substr ($val, 1, -1);
$res[trim ($key)] = $val;
}

View File

@@ -451,7 +451,7 @@ echo "$res\n";
*/
private function lineType ($line)
{
if (! isset ($line{0}))
if (! isset ($line[0]))
return "NONE";
if (preg_match ("/^[ \t]*[+*-] /", $line) === 1)
return "ul";

View File

@@ -114,11 +114,11 @@ class Spfcheck
if ($ipaddresses->ipInNetwork ($ip, $ipToTest, $mask))
{
$this->matchRule = "$key/$part";
if ($part{0} === "-")
if ($part[0] === "-")
return "FAIL";
if ($part{0} === "~")
if ($part[0] === "~")
return "SOFTFAIL";
if ($part{0} === "?")
if ($part[0] === "?")
return "NEUTRAL";
return "PASS";
}
@@ -259,8 +259,8 @@ class Spfcheck
$ips[$domain][$part] = array ();
// Manage the sign in front of part
$sign = "";
if ($part{0} === "+" || $part{0} === "-" || $part{0} === "~" ||
$part{0} === "?")
if ($part[0] === "+" || $part[0] === "-" || $part[0] === "~" ||
$part[0] === "?")
{
$sign = $part[0];
$part = substr ($part, 1);