From 5166aa6744dc00c2bfe23023ba4ed76b27f8462f Mon Sep 17 00:00:00 2001 From: Alexander Rutz Date: Mon, 30 Nov 2020 21:35:49 +0100 Subject: [PATCH 1/4] Fix for PHP 7.2 and `count()` --- extension.meta.xml | 3 +++ lib/class.xmlimporter.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extension.meta.xml b/extension.meta.xml index ade61b7..b5428dd 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -26,6 +26,9 @@ + + - Fix for PHP 7.2 and `count()` + - Fix a problem with author id being unset diff --git a/lib/class.xmlimporter.php b/lib/class.xmlimporter.php index dd7e8e2..43b8ff7 100644 --- a/lib/class.xmlimporter.php +++ b/lib/class.xmlimporter.php @@ -264,10 +264,10 @@ function handleXMLError($errno, $errstr, $errfile, $errline, $context) { $field = FieldManager::fetch($field_id); if(is_array($value)) { - if(count($value) === 1) { + if(count(is_countable($value)) === 1) { $value = current($value); } - if(count($value) === 0) { + if(count(is_countable($value)) === 0) { $value = ''; } } From 287d1da821b696b06eb3cecff85040a64d421af6 Mon Sep 17 00:00:00 2001 From: Brian Zerangue Date: Mon, 30 Nov 2020 20:21:05 -0600 Subject: [PATCH 2/4] class.xmlimporter.php - switch is_countable() to array() On PHP 7.2 `is_countable` creates an undefined function. `is_countable` is not available until PHP 7.3, . In PHP 7.3, I get this error... "count(): Parameter must be an array or an object that implements Countable". BUT, I found this... instead of `is_countable($value)`, **it works with `array($value)`** which I got from this Stack Overflow post, . --- lib/class.xmlimporter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/class.xmlimporter.php b/lib/class.xmlimporter.php index 43b8ff7..e0d17c4 100644 --- a/lib/class.xmlimporter.php +++ b/lib/class.xmlimporter.php @@ -264,10 +264,10 @@ function handleXMLError($errno, $errstr, $errfile, $errline, $context) { $field = FieldManager::fetch($field_id); if(is_array($value)) { - if(count(is_countable($value)) === 1) { + if(count(array($value)) === 1) { $value = current($value); } - if(count(is_countable($value)) === 0) { + if(count(array($value)) === 0) { $value = ''; } } From 2fd8cafc20ae9a7b02863431d257d897311b6ce9 Mon Sep 17 00:00:00 2001 From: animaux Date: Tue, 1 Dec 2020 10:32:13 +0100 Subject: [PATCH 3/4] Fix for PHP 7.2 and `count()` that works in PHP < 7.3 too, thanks @bzerangue! --- extension.meta.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extension.meta.xml b/extension.meta.xml index b5428dd..3228e8c 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -26,6 +26,9 @@ + + - Fix for PHP 7.2 and `count()` that works in PHP < 7.3 too, thanks @bzerangue! + - Fix for PHP 7.2 and `count()` From 62830c1f28b8097a57de03afec75245a5584e4c0 Mon Sep 17 00:00:00 2001 From: Brian Zerangue Date: Sun, 3 Jan 2021 21:13:28 -0600 Subject: [PATCH 4/4] Update extension.meta.xml Fixed the less than character as < is invalid and should be < That character caused an error in the installation process --- extension.meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.meta.xml b/extension.meta.xml index 3228e8c..e3e040a 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -27,7 +27,7 @@ - - Fix for PHP 7.2 and `count()` that works in PHP < 7.3 too, thanks @bzerangue! + - Fix for PHP 7.2 and `count()` that works in PHP < 7.3 too, thanks @bzerangue! - Fix for PHP 7.2 and `count()`