[packages/php-pear-Text_CAPTCHA] Rel 3; php8

arekm arekm at pld-linux.org
Mon May 4 13:00:58 CEST 2026


commit b05cdab68bf84713617c020b63c8ee8a45d8cc24
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon May 4 13:00:51 2026 +0200

    Rel 3; php8

 php-pear-Text_CAPTCHA-php8.patch | 42 ++++++++++++++++++++++++++++++++++++++++
 php-pear-Text_CAPTCHA.spec       | 10 +++++++---
 2 files changed, 49 insertions(+), 3 deletions(-)
---
diff --git a/php-pear-Text_CAPTCHA.spec b/php-pear-Text_CAPTCHA.spec
index 543bef1..cba0ecf 100644
--- a/php-pear-Text_CAPTCHA.spec
+++ b/php-pear-Text_CAPTCHA.spec
@@ -4,12 +4,13 @@ Summary:	%{_pearname} - generation of CAPTCHA imgaes
 Summary(pl.UTF-8):	%{_pearname} - generowanie obrazów CAPTCHA
 Name:		php-pear-%{_pearname}
 Version:	1.0.2
-Release:	2
+Release:	3
 License:	PHP 2.02
 Group:		Development/Languages/PHP
-Source0:	http://pear.php.net/get/%{_pearname}-%{version}.tgz
+Source0:	https://pear.php.net/get/%{_pearname}-%{version}.tgz
 # Source0-md5:	3c30c8650436ea2e961c29e9eedf0066
-URL:		http://pear.php.net/package/
+Patch0:		%{name}-php8.patch
+URL:		https://pear.php.net/package/Text_CAPTCHA/
 BuildRequires:	php-pear-PEAR >= 1:1.4.0-0.b1
 BuildRequires:	rpm-php-pearprov >= 4.4.2-11
 BuildRequires:	rpmbuild(macros) >= 1.571
@@ -39,6 +40,9 @@ Ta klasa ma w PEAR status: %{_status}.
 
 %prep
 %pear_package_setup
+cd ./%{php_pear_dir}
+%patch -P0 -p1
+cd -
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/php-pear-Text_CAPTCHA-php8.patch b/php-pear-Text_CAPTCHA-php8.patch
new file mode 100644
index 0000000..206a04d
--- /dev/null
+++ b/php-pear-Text_CAPTCHA-php8.patch
@@ -0,0 +1,42 @@
+Replace removed create_function() (gone in PHP 8.0). Compute the result
+directly from the known operator format strings instead of evaluating the
+formatted equation string at runtime.
+
+--- Text_CAPTCHA-1.0.2.org/Text/CAPTCHA/Driver/Equation.php	2017-01-01 00:00:00.000000000 +0200
++++ Text_CAPTCHA-1.0.2/Text/CAPTCHA/Driver/Equation.php	2026-05-04 00:00:00.000000000 +0200
+@@ -188,7 +188,25 @@
+     {
+         $equation = sprintf($operator, $one, $two);
+
+-        $function = create_function('', 'return ' . $equation . ';');
++        switch ($operator) {
++            case '%s * %s':
++                $result = $one * $two;
++                break;
++            case '%s + %s':
++                $result = $one + $two;
++                break;
++            case '%s - %s':
++                $result = $one - $two;
++                break;
++            case 'min(%s, %s)':
++                $result = min($one, $two);
++                break;
++            case 'max(%s, %s)':
++                $result = max($one, $two);
++                break;
++            default:
++                $result = null;
++        }
+
+         if ($this->_numbersToText) {
+             $numberWords = new Numbers_Words();
+@@ -198,7 +216,7 @@
+                 $numberWords->toWords($two, $this->_locale)
+             );
+         }
+-        return array($equation, $function());
++        return array($equation, $result);
+     }
+
+     /**
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-pear-Text_CAPTCHA.git/commitdiff/b05cdab68bf84713617c020b63c8ee8a45d8cc24



More information about the pld-cvs-commit mailing list