Skip to content

Commit

Permalink
another PHP 7.3 fix (matomo-org#15204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Findus23 authored and jbuget committed Sep 26, 2020
1 parent a716388 commit 33a3d89
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions libs/upgradephp/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
* script execution on setups where the native functions already exist. It
* is meant as quick drop-in solution. It spares you from rewriting code or
* using cumbersome workarounds instead of the more powerful v5 functions.
*
*
* It cannot mirror PHP5s extended OO-semantics and functionality into PHP4
* however. A few features are added here that weren't part of PHP yet. And
* some other function collections are separated out into the ext/ directory.
* It doesn't produce many custom error messages (YAGNI), and instead leaves
* reporting to invoked functions or for native PHP execution.
*
*
* And further this is PUBLIC DOMAIN (no copyright, no license, no warranty)
* so therefore compatible to ALL open source licenses. You could rip this
* paragraph out to republish this instead only under more restrictive terms
Expand Down Expand Up @@ -177,7 +177,7 @@ function _parse_ini_file($filename, $process_sections = false)
if (!preg_match('/^[a-zA-Z0-9[]/', $line)) {continue;}

// Sections
if ($line{0} == '[') {
if ($line[0] == '[') {
$tmp = explode(']', $line);
$sections[] = trim(substr($tmp[0], 1));
$i++;
Expand All @@ -191,15 +191,15 @@ function _parse_ini_file($filename, $process_sections = false)
if (strstr($value, ";")) {
$tmp = explode(';', $value);
if (count($tmp) == 2) {
if ((($value{0} != '"') && ($value{0} != "'")) ||
if ((($value[0] != '"') && ($value[0] != "'")) ||
preg_match('/^".*"\s*;/', $value) || preg_match('/^".*;[^"]*$/', $value) ||
preg_match("/^'.*'\s*;/", $value) || preg_match("/^'.*;[^']*$/", $value) ){
$value = $tmp[0];
}
} else {
if ($value{0} == '"') {
if ($value[0] == '"') {
$value = preg_replace('/^"(.*)".*/', '$1', $value);
} elseif ($value{0} == "'") {
} elseif ($value[0] == "'") {
$value = preg_replace("/^'(.*)'.*/", '$1', $value);
} else {
$value = $tmp[0];
Expand Down Expand Up @@ -271,7 +271,7 @@ function _glob($pattern, $flags = 0) {
&& fnmatch($filePattern, $file)
&& (!($flags & GLOB_ONLYDIR) || is_dir("$path/$file"))) {
$matches[] = "$path/$file" . ($flags & GLOB_MARK ? '/' : '');
}
}
}
closedir($handle);
if(!($flags & GLOB_NOSORT)) {
Expand Down Expand Up @@ -362,7 +362,7 @@ function _safe_serialize( $value )
{
$out .= _safe_serialize($k) . _safe_serialize($v);
}

return 'a:'.count($value).':{'.$out.'}';
}

Expand Down Expand Up @@ -718,4 +718,4 @@ function fnmatch($pattern, $string) {
return preg_match("#^".strtr(preg_quote($pattern, '#'), array('\*' => '.*', '\?' => '.'))."$#i", $string);
} // end

} // end if
} // end if

0 comments on commit 33a3d89

Please sign in to comment.