From a88f703367ab0818a6736f91723b443789131fc7 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Wed, 16 Aug 2023 14:13:26 +0300 Subject: [PATCH] Making PHPStan happy --- .gitignore | 1 + jzon.inc.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/jzon.inc.php b/jzon.inc.php index 3a027fe..29efc35 100644 --- a/jzon.inc.php +++ b/jzon.inc.php @@ -290,10 +290,11 @@ class jzonParser ++$this->c; } + $str_num = substr($this->in, $start, $this->c - $start); if($is_float) - $out = 1*substr($this->in, $start, $this->c - $start); + $out = floatval($str_num); else - $out = (int)(1*substr($this->in, $start, $this->c - $start)); + $out = intval($str_num); } private function parse_true(&$out) @@ -340,7 +341,7 @@ function jzon_parse($str) return $res; //NOTE: only allowing extension implementation if versions match - if(JZON_EXT_VERSION === JZON_VERSION) + if(defined('JZON_EXT_VERSION') && JZON_EXT_VERSION === JZON_VERSION) { list($ok, $err, $err_pos, $res) = jzon_parse_c($str); if(!$ok)