Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another PHP 7.4 fix #15204

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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