From ebdcfdf6332ecdc9712d4cbf483302f49d07608d Mon Sep 17 00:00:00 2001 From: "Franco.vitelli" Date: Wed, 31 Mar 2021 15:10:29 +0200 Subject: [PATCH] Fix backward compatibility classes --- lib/bcmath.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/bcmath.php b/lib/bcmath.php index 75aa46a..3b039a2 100644 --- a/lib/bcmath.php +++ b/lib/bcmath.php @@ -169,17 +169,20 @@ class TypeError extends Error { } } +$autoLoad = version_compare(PHP_VERSION, '7.1.0', '>='); // the following was introduced in PHP 7.1.0 -if (!class_exists('ArgumentCountError')) { +if (!class_exists('ArgumentCountError', $autoload)) { class ArgumentCountError extends TypeError { } } +$autoLoad = version_compare(PHP_VERSION, '8.0.0', '>='); + // the following was introduced in PHP 8.0.0 -if (!class_exists('ValueError')) { +if (!class_exists('ValueError', $autoload)) { class ValueError extends Error { } -} \ No newline at end of file +}