Compare commits

...

4 Commits

Author SHA1 Message Date
Dominique FOURNIER
72b3251b1e Tests/OutputhtmlTest.php : html code is now indented 2022-06-14 16:48:02 +02:00
Dominique FOURNIER
5f0fdd951f Tests/RobotstxtTest.php : The crawldelay is "null" if not defined in robots.txt file 2022-06-14 16:40:39 +02:00
Dominique FOURNIER
899221558a Tests/SpfcheckTest.php : Update Fournier38 IP addresses 2022-06-14 16:39:07 +02:00
Dominique FOURNIER
a60db30785 PHP Deprecated: Array and string offset access syntax with curly braces is deprecated 2022-06-14 16:33:31 +02:00
11 changed files with 39 additions and 35 deletions

View File

@@ -37,10 +37,12 @@ class OutputhtmlTest extends \PHPUnit_Framework_TestCase
public function testlayout4 ()
{
$this->expectOutputString("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">
<html><body>
<html>
<body>
Text
"." "."
</body></html>\n");
</body>
</html>\n");
$output = new Outputhtml ();
$output->out ("data", "title", FALSE, FALSE, "Tests/layout.html" );
}
@@ -48,10 +50,12 @@ class OutputhtmlTest extends \PHPUnit_Framework_TestCase
public function testlayout5 ()
{
$this->expectOutputString("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">
<html><body>
<html>
<body>
Text
VARIABLE
</body></html>\n");
</body>
</html>\n");
$output = new Outputhtml ();
$variable = array ("var"=>"VARIABLE");
$output->out ("data", "title", FALSE, FALSE, "Tests/layout.html",

View File

@@ -36,7 +36,7 @@ class RobotstxtTest extends \PHPUnit_Framework_TestCase
{
$robotstxt = new Robotstxt ("", "domsearch");
$res = $robotstxt->crawldelay ();
$this->assertSame ($res, 3);
$this->assertSame ($res, null);
}
// Allow

View File

@@ -74,10 +74,10 @@ class SpfcheckTest extends \PHPUnit_Framework_TestCase
$this->assertSame ($res,
array ("mxvalid.spf.tester.fournier38.fr" => array (
"mx:tester.fournier38.fr" => array (
"2a01:e0a:163:38f1::103",
"2a01:e0a:2a7:9cd0::206",
"82.64.55.197",
"82.64.75.195"),
"2a01:e0a:2a7:9cd1::103",
"2a01:e0a:392:ab60::206",
"82.64.75.195",
"82.66.67.64"),
"-all" => array ())));
}
@@ -97,8 +97,8 @@ class SpfcheckTest extends \PHPUnit_Framework_TestCase
$this->assertSame ($res,
array ("avalid.spf.tester.fournier38.fr" => array (
"a:tester.fournier38.fr" => array (
"2a01:e0a:163:38f1::100",
"82.64.55.197",),
"2a01:e0a:2a7:9cd1::100",
"82.64.75.195",),
"-all" => array ())));
}

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);