Apply automated PHP8 safety transforms
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/89922108-1604-44ae-949d-358d32b9d70a Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
aca850b6cd
commit
e44519c030
465 changed files with 1716 additions and 1716 deletions
|
|
@ -187,7 +187,7 @@ see --help for help
|
|||
// user provided language
|
||||
$scanners = luminous::scanners();
|
||||
$valid_scanner = false;
|
||||
foreach($scanners as $lang=>$codes) {
|
||||
foreach ((array)$scanners as $lang=>$codes) {
|
||||
if (in_array($this->options['lang'], $codes)) {
|
||||
$valid_scanner = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class LuminousFilters {
|
|||
$start = "$lead<DOCTAG>$tag_char$tag</DOCTAG><DOCPROPERTY>";
|
||||
|
||||
$j = 0;
|
||||
$c = count($l);
|
||||
$c = count((array)$l);
|
||||
for($i=0; $j<$len && $i<$c; $i++)
|
||||
{
|
||||
$s = $l[$i];
|
||||
|
|
@ -268,7 +268,7 @@ class LuminousFilters {
|
|||
* This is a stream filter.
|
||||
*/
|
||||
static function oo_stream_filter($tokens) {
|
||||
$c = count($tokens);
|
||||
$c = count((array)$tokens);
|
||||
for($i=0; $i<$c; $i++) {
|
||||
if ($tokens[$i][0] !== 'IDENT') continue;
|
||||
if ($i > 0) {
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ class Scanner {
|
|||
$matches = null;
|
||||
$name = null;
|
||||
$m;
|
||||
foreach($patterns as $name_=>$p) {
|
||||
foreach ((array)$patterns as $name_=>$p) {
|
||||
$index = $this->ss->match($p, $this->index, $m);
|
||||
if ($index === false) continue;
|
||||
if ($next === -1 || $index < $next) {
|
||||
|
|
@ -500,7 +500,7 @@ class Scanner {
|
|||
function get_next($patterns) {
|
||||
$next = -1;
|
||||
$matches = null;
|
||||
foreach($patterns as $p) {
|
||||
foreach ((array)$patterns as $p) {
|
||||
$m;
|
||||
$index = $this->ss->match($p, $this->index, $m);
|
||||
if ($index === false) continue;
|
||||
|
|
@ -524,7 +524,7 @@ class Scanner {
|
|||
function get_next_strpos($patterns) {
|
||||
$next = -1;
|
||||
$match = null;
|
||||
foreach($patterns as $p) {
|
||||
foreach ((array)$patterns as $p) {
|
||||
$index = strpos($this->src, $p, $this->index);
|
||||
if ($index === false) continue;
|
||||
if ($next === -1 || $index < $next) {
|
||||
|
|
@ -802,7 +802,7 @@ class LuminousScanner extends Scanner {
|
|||
* @internal
|
||||
*/
|
||||
protected function rule_mapper_filter($tokens) {
|
||||
foreach($tokens as &$t) {
|
||||
foreach ((array)$tokens as &$t) {
|
||||
if (array_key_exists($t[0], $this->rule_tag_map))
|
||||
$t[0] = $this->rule_tag_map[$t[0]];
|
||||
}
|
||||
|
|
@ -884,7 +884,7 @@ class LuminousScanner extends Scanner {
|
|||
*/
|
||||
public function remove_filter($name) {
|
||||
foreach($this->filters as $token=>$filters) {
|
||||
foreach($filters as $k=>$f) {
|
||||
foreach ((array)$filters as $k=>$f) {
|
||||
if ($f[0] === $name) unset($this->filters[$token][$k]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1057,7 +1057,7 @@ class LuminousScanner extends Scanner {
|
|||
*/
|
||||
function add_identifier_mapping($name, $matches) {
|
||||
$array = array();
|
||||
foreach($matches as $m) {
|
||||
foreach ((array)$matches as $m) {
|
||||
if (!$this->case_sensitive) $m = strtolower($m);
|
||||
$array[$m] = true;
|
||||
}
|
||||
|
|
@ -1825,7 +1825,7 @@ class LuminousStatefulScanner extends LuminousSimpleScanner {
|
|||
*/
|
||||
protected function collapse_token_tree($node) {
|
||||
$text = '';
|
||||
foreach($node['children'] as $c) {
|
||||
foreach ((array)$node['children'] as $c) {
|
||||
if (is_string($c)) $text .= LuminousUtils::escape_string($c);
|
||||
else $text .= $this->collapse_token_tree($c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class LuminousStringSearch
|
|||
|
||||
$r = $matches_[0][1];
|
||||
// strip the offsets from the match_groups
|
||||
foreach($matches_ as $i=>&$v)
|
||||
foreach ((array)$matches_ as $i=>&$v)
|
||||
$v = $v[0];
|
||||
|
||||
$this->cache[$search] = array($r, $matches_);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ abstract class LuminousFormatter {
|
|||
$num_lines = 1;
|
||||
|
||||
$num_open = 0;
|
||||
foreach($line_split as $l) {
|
||||
foreach ((array)$line_split as $l) {
|
||||
|
||||
$l0 = $l[0];
|
||||
if ($l0 === '<') {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class LuminousHTMLTemplates {
|
|||
$template = self::_strip_template_whitespace($template);
|
||||
}
|
||||
|
||||
foreach($variables as $search => $replace) {
|
||||
foreach ((array)$variables as $search => $replace) {
|
||||
$template = str_replace("{" . $search . "}", $replace, $template);
|
||||
}
|
||||
return $template;
|
||||
|
|
@ -138,7 +138,7 @@ class LuminousFormatterHTML extends LuminousFormatter {
|
|||
private function lines_numberless($src) {
|
||||
$lines = array();
|
||||
$lines_original = explode("\n", $src);
|
||||
foreach($lines_original as $line) {
|
||||
foreach ((array)$lines_original as $line) {
|
||||
$l = $line;
|
||||
$num = $this->wrap_line($l, $this->wrap_length);
|
||||
// strip the newline if we're going to join it. Seems the easiest way to
|
||||
|
|
@ -212,7 +212,7 @@ class LuminousFormatterHTML extends LuminousFormatter {
|
|||
preg_match_all("/<\/([^\s>]*).*?>/", $matches[0], $close_tags,
|
||||
PREG_SET_ORDER);
|
||||
|
||||
if (count($open_tags) != count($close_tags))
|
||||
if (count((array)$open_tags) != count((array)$close_tags))
|
||||
return $matches[0];
|
||||
if (isset($open_tags[0])
|
||||
&& trim($open_tags[0][1]) !== trim($close_tags[0][1])
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ EOF;
|
|||
|
||||
if ($this->wrap_length > 0) {
|
||||
$str = '';
|
||||
foreach($lines as $i=>$l) {
|
||||
foreach ((array)$lines as $i=>$l) {
|
||||
$this->wrap_line($l, $this->wrap_length);
|
||||
$str .= $l;
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ EOF;
|
|||
return "{\\\textbackslash}";
|
||||
return "\\\" . $matches[0];');
|
||||
|
||||
foreach($str_ as $s_) {
|
||||
foreach ((array)$str_ as $s_) {
|
||||
if ($s_[0] === '<') {
|
||||
$s_ = preg_replace('%</[^>]+>%', '}', $s_);
|
||||
$s_ = preg_replace_callback('%<([^>]+)>%', $f1
|
||||
|
|
@ -167,7 +167,7 @@ EOF;
|
|||
// NOTE: p being a reference is probably going to necessitate a lot of
|
||||
// copying to pass through all these preg_* and str* calls.
|
||||
// consider rewriting.
|
||||
foreach($pieces as $k=>&$p) {
|
||||
foreach ((array)$pieces as $k=>&$p) {
|
||||
if (preg_match('/^\\\lms/', $p))
|
||||
$stack[] = "" . $p;
|
||||
elseif(preg_match('/^(\\\\\\\\)*\}/', $p)) {
|
||||
|
|
@ -178,7 +178,7 @@ EOF;
|
|||
elseif(strpos($p, "\n") !== false) {
|
||||
$before = "";
|
||||
$after = "";
|
||||
foreach($stack as $st_) {
|
||||
foreach ((array)$stack as $st_) {
|
||||
$before .= $st_;
|
||||
$after .= '}';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ class _Luminous {
|
|||
throw new Exception('Luminous internal error: Settings is not an array');
|
||||
}
|
||||
$old_settings = clone $this->settings;
|
||||
foreach($settings as $k=>$v) {
|
||||
foreach ((array)$settings as $k=>$v) {
|
||||
$this->settings->set($k, $v);
|
||||
}
|
||||
}
|
||||
|
|
@ -551,7 +551,7 @@ abstract class luminous {
|
|||
|
||||
$info = array(
|
||||
'lines' => $lines,
|
||||
'num_lines' => count($lines),
|
||||
'num_lines' => count((array)$lines),
|
||||
'trimmed' => trim($src),
|
||||
'shebang' => $shebang
|
||||
);
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class LuminousOptions {
|
|||
if (!is_array($array)) {
|
||||
$array = array($nameOrArray => $value);
|
||||
}
|
||||
foreach($array as $option => $value) {
|
||||
foreach ((array)$array as $option => $value) {
|
||||
// for backwards compatibility we need to do this here
|
||||
$option = str_replace('-', '_', $option);
|
||||
$this->__set($option, $value);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class LuminousScanners
|
|||
);
|
||||
if (!is_array($language_name))
|
||||
$language_name = array($language_name);
|
||||
foreach($language_name as $l) {
|
||||
foreach ((array)$language_name as $l) {
|
||||
$this->lookup_table[$l] = $insert;
|
||||
if (!$dummy)
|
||||
$this->AddDescription($lang_description, $l);
|
||||
|
|
@ -94,7 +94,7 @@ class LuminousScanners
|
|||
{
|
||||
foreach($this->descriptions as &$d)
|
||||
{
|
||||
foreach($d as $k=>$l)
|
||||
foreach ((array)$d as $k=>$l)
|
||||
{
|
||||
if($l === $language_name)
|
||||
unset($d[$k]);
|
||||
|
|
@ -112,7 +112,7 @@ class LuminousScanners
|
|||
{
|
||||
if (is_array($language_name))
|
||||
{
|
||||
foreach($language_name as $l)
|
||||
foreach ((array)$language_name as $l)
|
||||
{
|
||||
unset($this->lookup_table[$l]);
|
||||
$this->UnsetDescription($l);
|
||||
|
|
@ -160,7 +160,7 @@ class LuminousScanners
|
|||
if (!isset($this->resolved_dependencies[$language_name]))
|
||||
{
|
||||
$this->resolved_dependencies[$language_name] = true;
|
||||
foreach($g['dependencies'] as $d)
|
||||
foreach ((array)$g['dependencies'] as $d)
|
||||
{
|
||||
$this->GetScannerArray($d, $default);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,16 +241,16 @@ class LuminousCSSParser {
|
|||
$css_ = array();
|
||||
|
||||
// now cleanup the array, drop !important
|
||||
foreach($css as $selector=>$rules) {
|
||||
foreach ((array)$css as $selector=>$rules) {
|
||||
$rules_ = array();
|
||||
foreach($rules as $prop=>$value) {
|
||||
foreach ((array)$rules as $prop=>$value) {
|
||||
list($prop, $value) = self::format_property_value($prop, $value);
|
||||
$rules_[$prop] = $value;
|
||||
}
|
||||
// now split selector by comma
|
||||
$selectors = preg_split('/\s*,\s*/', $selector);
|
||||
|
||||
foreach($selectors as $s) {
|
||||
foreach ((array)$selectors as $s) {
|
||||
// drop .luminous from the selector
|
||||
$s = preg_replace('/^\.luminous\s*/', '', $s);
|
||||
// now we assume that if something is in the form .classname then
|
||||
|
|
@ -329,7 +329,7 @@ class LuminousCSSParser {
|
|||
$css = array();
|
||||
// array of selectors => rules, where rules is an array itself of (property, value)
|
||||
// note this is going to get @font-face wrong, but we don't care about that.
|
||||
for($i=0; $i<count($tokens); $i++) {
|
||||
for($i=0; $i<count((array)$tokens); $i++) {
|
||||
list($tok, $content, ) = $tokens[$i];
|
||||
if ($tok === 'COMMENT') continue;
|
||||
if (!$block) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue