From 753bab40c97bccccb3a03331e371cc6181f14073 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 15 Dec 2020 15:06:03 +0800 Subject: [PATCH] php7 fixes --- Code.php | 14 +++++++------- FormToSQL.php | 10 +++++----- Generator/JSON.php | 36 ++++++++++++++++++------------------ Palette.php | 9 ++++----- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/Code.php b/Code.php index 636e34c..6564e7e 100644 --- a/Code.php +++ b/Code.php @@ -412,19 +412,19 @@ class Pman_Builder_Code extends Pman case is_object($v): $out .= $ix . "$k : " . $this->toJSObj($v, $in+1); - continue; + continue 2; case is_array($v): $out .= $ix . "$k : " . $this->toJSAr($v, $in+1); - continue; + continue 2; case is_string($v) && ($k[0] == '|'): $out .= $ix . substr($k,1). ": " . implode("\n" . $ix, explode("\n", $v)); - continue; + continue 2; default : $out .= $ix . "$k : " . $this->toJSPrim($v, isset($obj->xtype) ? $obj->xtype : '', $k); - continue; + continue 2; } // property is string/bool/num... @@ -475,11 +475,11 @@ class Pman_Builder_Code extends Pman switch(true) { case is_object($v): $out .= $ix . $this->toJSObj($v, $in+1); - continue; + continue 2; case is_array($v): $out .= $ix . $this->toJSAr($v, $in+1); - continue; + continue 2; // case is_string($v) && ($k[0] == '|'): // can not have raw in an array? // $out .= $ix . . $v; @@ -487,7 +487,7 @@ class Pman_Builder_Code extends Pman default : $out .= $this->toJSPrim($v); // we can not fix these...!!!! - continue; + continue 2; } } diff --git a/FormToSQL.php b/FormToSQL.php index a0d451a..835ee30 100644 --- a/FormToSQL.php +++ b/FormToSQL.php @@ -139,7 +139,7 @@ class Pman_Builder_FormToSQL extends Pman { $f->type = $type; $f->size = $len; $this->cols[] = $f; - continue; + break; } // otherwise it's a datasource based one... // our 18N fields are a bit odd here... @@ -149,7 +149,7 @@ class Pman_Builder_FormToSQL extends Pman { $f->size = 8; $f->default = "''"; $this->cols[] = $f; - continue; + break; } $f->name = isset($o->hiddenName) ? $o->hiddenName : $o->name; $f->type = 'INT'; @@ -157,14 +157,14 @@ class Pman_Builder_FormToSQL extends Pman { $f->extra = "NOT NULL"; $f->default = 0; $this->cols[] = $f; - continue; + break; case 'TextArea': $f->name = $o->name; $f->type = 'TEXT'; $this->cols[] = $f; - continue; + break; case 'DateField': case 'NumberField': @@ -186,7 +186,7 @@ class Pman_Builder_FormToSQL extends Pman { array_unshift($this->cols, $f); break; default: - continue; + break; } diff --git a/Generator/JSON.php b/Generator/JSON.php index 2dfe067..7763c2d 100644 --- a/Generator/JSON.php +++ b/Generator/JSON.php @@ -51,7 +51,7 @@ class Pman_Builder_Generator_JSON extends Services_JSON */ for ($c = 0; $c < $strlen_var; ++$c) { - $ord_var_c = ord($var{$c}); + $ord_var_c = ord($var[$c]); switch (true) { case $ord_var_c == 0x08: @@ -74,12 +74,12 @@ class Pman_Builder_Generator_JSON extends Services_JSON case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; + $ascii .= '\\'.$var[$c]; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; + $ascii .= $var[$c]; break; case (($ord_var_c & 0xE0) == 0xC0): @@ -91,7 +91,7 @@ class Pman_Builder_Generator_JSON extends Services_JSON break; } - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $char = pack('C*', $ord_var_c, ord($var[$c + 1])); $c += 1; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -106,8 +106,8 @@ class Pman_Builder_Generator_JSON extends Services_JSON // characters U-00000800 - U-0000FFFF, mask 1110XXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - @ord($var{$c + 1}), - @ord($var{$c + 2})); + @ord($var[$c + 1]), + @ord($var[$c + 2])); $c += 2; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -122,9 +122,9 @@ class Pman_Builder_Generator_JSON extends Services_JSON // characters U-00010000 - U-001FFFFF, mask 11110XXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3])); $c += 3; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -139,10 +139,10 @@ class Pman_Builder_Generator_JSON extends Services_JSON break; } $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3]), + ord($var[$c + 4])); $c += 4; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -157,11 +157,11 @@ class Pman_Builder_Generator_JSON extends Services_JSON // characters U-04000000 - U-7FFFFFFF, mask 1111110X // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); + ord($var[$c + 1]), + ord($var[$c + 2]), + ord($var[$c + 3]), + ord($var[$c + 4]), + ord($var[$c + 5])); $c += 5; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); diff --git a/Palette.php b/Palette.php index 54f21bd..23912fc 100644 --- a/Palette.php +++ b/Palette.php @@ -99,7 +99,7 @@ class Pman_Builder_Palette extends Pman case 0: $left[] = $l; - continue; + continue 2; case 1: if (!isset($res[$l])) { $res[$l] = array(); @@ -107,12 +107,11 @@ class Pman_Builder_Palette extends Pman foreach($left as $ll) { $res[$l][$ll] = true; } - continue; + continue 2; default: - continue; + continue 2; } - - + } $ret = array(); ksort($res); -- 2.39.2