diff options
author | Remi Collet <remi@remirepo.net> | 2025-09-29 08:33:05 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2025-09-29 08:33:05 +0200 |
commit | a6a14575a84d3571aa4f7ebb5fbbcda6143c69a8 (patch) | |
tree | 4300f52bfa9da01c70a7d35a3a3024858d5f03ca | |
parent | 80e34c964095c04da3c805536bcba566e2d341b8 (diff) |
fix test suite for PHP 8.5.0RC1 using patch fromv1
https://github.com/php-decimal/ext-decimal/pull/89
-rw-r--r-- | 0001-Silent-unexpected-NAN-value-was-coerced-to-string-wa.patch | 189 | ||||
-rw-r--r-- | php-pecl-decimal.spec | 70 |
2 files changed, 219 insertions, 40 deletions
diff --git a/0001-Silent-unexpected-NAN-value-was-coerced-to-string-wa.patch b/0001-Silent-unexpected-NAN-value-was-coerced-to-string-wa.patch new file mode 100644 index 0000000..5931087 --- /dev/null +++ b/0001-Silent-unexpected-NAN-value-was-coerced-to-string-wa.patch @@ -0,0 +1,189 @@ +From 52477ad2c4739d291644ff87ac62794d686df7fe Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 29 Sep 2025 08:27:04 +0200 +Subject: [PATCH] Silent "unexpected NAN value was coerced to string" warning + +--- + tests/php7/cast.phpt | 2 +- + tests/php7/methods/add.phpt | 18 +++++++++--------- + tests/php7/methods/div.phpt | 18 +++++++++--------- + tests/php7/methods/ln.phpt | 10 +++++----- + tests/php7/methods/log10.phpt | 10 +++++----- + tests/php7/methods/mul.phpt | 18 +++++++++--------- + tests/php7/methods/sub.phpt | 18 +++++++++--------- + 7 files changed, 47 insertions(+), 47 deletions(-) + +diff --git a/tests/php7/cast.phpt b/tests/php7/cast.phpt +index bb42d28..464e06b 100644 +--- a/tests/php7/cast.phpt ++++ b/tests/php7/cast.phpt +@@ -64,7 +64,7 @@ $tests = [ + [(float) decimal("1234.5678E+9"), 1.2345678E+12], + [(float) decimal("1234.5678E+90"), 1.2345678E+93], + +- [(string) (float) decimal( "NAN"), "NAN"], ++ [@(string) (float) decimal( "NAN"), "NAN"], + [(string) (float) decimal( "INF"), "INF"], + [(string) (float) decimal("-INF"), "-INF"], + +diff --git a/tests/php7/methods/add.phpt b/tests/php7/methods/add.phpt +index 18708d2..0eb2bd9 100644 +--- a/tests/php7/methods/add.phpt ++++ b/tests/php7/methods/add.phpt +@@ -69,15 +69,15 @@ $tests = [ + ], + + /* Special numbers */ +- [new Decimal( "NAN"), "NAN", (string) (NAN + NAN), 28], +- [new Decimal( "NAN"), "INF", (string) (NAN + INF), 28], +- [new Decimal( "NAN"), "-INF", (string) (NAN + -INF), 28], +- [new Decimal( "INF"), "NAN", (string) (INF + NAN), 28], +- [new Decimal( "INF"), "INF", (string) (INF + INF), 28], +- [new Decimal( "INF"), "-INF", (string) (INF + -INF), 28], +- [new Decimal("-INF"), "NAN", (string) (-INF + NAN), 28], +- [new Decimal("-INF"), "INF", (string) (-INF + INF), 28], +- [new Decimal("-INF"), "-INF", (string) (-INF + -INF), 28], ++ [new Decimal( "NAN"), "NAN", @(string) (NAN + NAN), 28], ++ [new Decimal( "NAN"), "INF", @(string) (NAN + INF), 28], ++ [new Decimal( "NAN"), "-INF", @(string) (NAN + -INF), 28], ++ [new Decimal( "INF"), "NAN", @(string) (INF + NAN), 28], ++ [new Decimal( "INF"), "INF", @(string) (INF + INF), 28], ++ [new Decimal( "INF"), "-INF", @(string) (INF + -INF), 28], ++ [new Decimal("-INF"), "NAN", @(string) (-INF + NAN), 28], ++ [new Decimal("-INF"), "INF", @(string) (-INF + INF), 28], ++ [new Decimal("-INF"), "-INF", @(string) (-INF + -INF), 28], + ]; + + foreach ($tests as $index => $test) { +diff --git a/tests/php7/methods/div.phpt b/tests/php7/methods/div.phpt +index 748922d..01d364f 100644 +--- a/tests/php7/methods/div.phpt ++++ b/tests/php7/methods/div.phpt +@@ -56,15 +56,15 @@ $tests = [ + ], + + /* Special numbers */ +- [new Decimal( "NAN"), "NAN", (string) (NAN / NAN), 28], +- [new Decimal( "NAN"), "INF", (string) (NAN / INF), 28], +- [new Decimal( "NAN"), "-INF", (string) (NAN / -INF), 28], +- [new Decimal( "INF"), "NAN", (string) (INF / NAN), 28], +- [new Decimal( "INF"), "INF", (string) (INF / INF), 28], +- [new Decimal( "INF"), "-INF", (string) (INF / -INF), 28], +- [new Decimal("-INF"), "NAN", (string) (-INF / NAN), 28], +- [new Decimal("-INF"), "INF", (string) (-INF / INF), 28], +- [new Decimal("-INF"), "-INF", (string) (-INF / -INF), 28], ++ [new Decimal( "NAN"), "NAN", @(string) (NAN / NAN), 28], ++ [new Decimal( "NAN"), "INF", @(string) (NAN / INF), 28], ++ [new Decimal( "NAN"), "-INF", @(string) (NAN / -INF), 28], ++ [new Decimal( "INF"), "NAN", @(string) (INF / NAN), 28], ++ [new Decimal( "INF"), "INF", @(string) (INF / INF), 28], ++ [new Decimal( "INF"), "-INF", @(string) (INF / -INF), 28], ++ [new Decimal("-INF"), "NAN", @(string) (-INF / NAN), 28], ++ [new Decimal("-INF"), "INF", @(string) (-INF / INF), 28], ++ [new Decimal("-INF"), "-INF", @(string) (-INF / -INF), 28], + ]; + + foreach ($tests as $index => $test) { +diff --git a/tests/php7/methods/ln.phpt b/tests/php7/methods/ln.phpt +index 29292a7..be5989b 100644 +--- a/tests/php7/methods/ln.phpt ++++ b/tests/php7/methods/ln.phpt +@@ -36,11 +36,11 @@ $tests = [ + [decimal("0.000123456"), "-8.999625740681010220998716623", 28], + [decimal("0.000123456", 50), "-8.9996257406810102209987166229396596684344507962672", 50], + +- [decimal("-INF"), (string) log(-INF), 28], +- [decimal( "NAN"), (string) log( NAN), 28], +- [decimal( "INF"), (string) log( INF), 28], +- [decimal( "0"), (string) log( 0), 28], +- [decimal( "-1"), (string) log( -1), 28], ++ [decimal("-INF"), @(string) log(-INF), 28], ++ [decimal( "NAN"), @(string) log( NAN), 28], ++ [decimal( "INF"), @(string) log( INF), 28], ++ [decimal( "0"), @(string) log( 0), 28], ++ [decimal( "-1"), @(string) log( -1), 28], + ]; + + foreach ($tests as $test) { +diff --git a/tests/php7/methods/log10.phpt b/tests/php7/methods/log10.phpt +index c92bb22..d055064 100644 +--- a/tests/php7/methods/log10.phpt ++++ b/tests/php7/methods/log10.phpt +@@ -36,11 +36,11 @@ $tests = [ + [decimal("0.000123456"), "-3.908487798372228318930600223", 28], + [decimal("0.000123456", 50), "-3.9084877983722283189306002229320942053464158123113", 50], + +- [decimal("-INF"), (string) log10(-INF), 28], +- [decimal( "NAN"), (string) log10( NAN), 28], +- [decimal( "INF"), (string) log10( INF), 28], +- [decimal( "0"), (string) log10( 0), 28], +- [decimal( "-1"), (string) log10( -1), 28], ++ [decimal("-INF"), @(string) log10(-INF), 28], ++ [decimal( "NAN"), @(string) log10( NAN), 28], ++ [decimal( "INF"), @(string) log10( INF), 28], ++ [decimal( "0"), @(string) log10( 0), 28], ++ [decimal( "-1"), @(string) log10( -1), 28], + ]; + + foreach ($tests as $test) { +diff --git a/tests/php7/methods/mul.phpt b/tests/php7/methods/mul.phpt +index 8577034..5de56be 100644 +--- a/tests/php7/methods/mul.phpt ++++ b/tests/php7/methods/mul.phpt +@@ -62,15 +62,15 @@ $tests = [ + ], + + /* Special numbers */ +- [new Decimal( "NAN"), "NAN", (string) (NAN * NAN), 28], +- [new Decimal( "NAN"), "INF", (string) (NAN * INF), 28], +- [new Decimal( "NAN"), "-INF", (string) (NAN * -INF), 28], +- [new Decimal( "INF"), "NAN", (string) (INF * NAN), 28], +- [new Decimal( "INF"), "INF", (string) (INF * INF), 28], +- [new Decimal( "INF"), "-INF", (string) (INF * -INF), 28], +- [new Decimal("-INF"), "NAN", (string) (-INF * NAN), 28], +- [new Decimal("-INF"), "INF", (string) (-INF * INF), 28], +- [new Decimal("-INF"), "-INF", (string) (-INF * -INF), 28], ++ [new Decimal( "NAN"), "NAN", @(string) (NAN * NAN), 28], ++ [new Decimal( "NAN"), "INF", @(string) (NAN * INF), 28], ++ [new Decimal( "NAN"), "-INF", @(string) (NAN * -INF), 28], ++ [new Decimal( "INF"), "NAN", @(string) (INF * NAN), 28], ++ [new Decimal( "INF"), "INF", @(string) (INF * INF), 28], ++ [new Decimal( "INF"), "-INF", @(string) (INF * -INF), 28], ++ [new Decimal("-INF"), "NAN", @(string) (-INF * NAN), 28], ++ [new Decimal("-INF"), "INF", @(string) (-INF * INF), 28], ++ [new Decimal("-INF"), "-INF", @(string) (-INF * -INF), 28], + + [new Decimal( "NAN"), 0, "NAN", 28], + [new Decimal( "INF"), 0, "NAN", 28], +diff --git a/tests/php7/methods/sub.phpt b/tests/php7/methods/sub.phpt +index 525fe1a..d666c25 100644 +--- a/tests/php7/methods/sub.phpt ++++ b/tests/php7/methods/sub.phpt +@@ -66,15 +66,15 @@ $tests = [ + ], + + /* Special numbers */ +- [new Decimal( "NAN"), "NAN", (string) (NAN - NAN), 28], +- [new Decimal( "NAN"), "INF", (string) (NAN - INF), 28], +- [new Decimal( "NAN"), "-INF", (string) (NAN - -INF), 28], +- [new Decimal( "INF"), "NAN", (string) (INF - NAN), 28], +- [new Decimal( "INF"), "INF", (string) (INF - INF), 28], +- [new Decimal( "INF"), "-INF", (string) (INF - -INF), 28], +- [new Decimal("-INF"), "NAN", (string) (-INF - NAN), 28], +- [new Decimal("-INF"), "INF", (string) (-INF - INF), 28], +- [new Decimal("-INF"), "-INF", (string) (-INF - -INF), 28], ++ [new Decimal( "NAN"), "NAN", @(string) (NAN - NAN), 28], ++ [new Decimal( "NAN"), "INF", @(string) (NAN - INF), 28], ++ [new Decimal( "NAN"), "-INF", @(string) (NAN - -INF), 28], ++ [new Decimal( "INF"), "NAN", @(string) (INF - NAN), 28], ++ [new Decimal( "INF"), "INF", @(string) (INF - INF), 28], ++ [new Decimal( "INF"), "-INF", @(string) (INF - -INF), 28], ++ [new Decimal("-INF"), "NAN", @(string) (-INF - NAN), 28], ++ [new Decimal("-INF"), "INF", @(string) (-INF - INF), 28], ++ [new Decimal("-INF"), "-INF", @(string) (-INF - -INF), 28], + ]; + + foreach ($tests as $index => $test) { +-- +2.51.0 + diff --git a/php-pecl-decimal.spec b/php-pecl-decimal.spec index a838db2..27d09da 100644 --- a/php-pecl-decimal.spec +++ b/php-pecl-decimal.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-pecl-decimal # -# Copyright (c) 2018-2024 Remi Collet -# License: CC-BY-SA-4.0 -# http://creativecommons.org/licenses/by-sa/4.0/ +# SPDX-FileCopyrightText: Copyright 2018-2025 Remi Collet +# SPDX-License-Identifier: CECILL-2.1 +# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt # # Please, preserve the changelog entries # @@ -13,6 +13,8 @@ %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name decimal +%global pie_vend php-decimal +%global pie_proj ext-decimal # After 20-json.ini %global ini_name 40-%{pecl_name}.ini %global sources %{pecl_name}-%{version} @@ -21,11 +23,13 @@ Summary: Arbitrary-precision floating-point decimal Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 1.5.0 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{sources}.tgz +Patch0: 0001-Silent-unexpected-NAN-value-was-coerced-to-string-wa.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 @@ -36,17 +40,21 @@ BuildRequires: mpdecimal-devel >= 2.4 Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-json%{?_isa} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} -Provides: %{?scl_prefix}php-%{pecl_name} = %{version} -Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} -Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} -Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# Extension +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +# PECL +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# PIE +Provides: %{?scl_prefix}php-pie(%{pie_vend}/%{pie_proj}) = %{version} +Provides: %{?scl_prefix}php-%{pie_vend}-%{pie_proj} = %{version} %description Adds support for correctly-rounded arbitrary precision decimal floating point -arithmetic in PHP 7. +arithmetic in PHP. Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. @@ -55,10 +63,12 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %setup -q -c sed -e 's/role="test"/role="src"/' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml cd %{sources} +%patch -P0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_DECIMAL_VERSION/{s/.* "//;s/".*$//;p}' php_decimal.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -125,26 +135,6 @@ do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done -%if 0%{?fedora} < 24 && 0%{?rhel} < 8 -# when pear installed alone, after us -%triggerin -- %{?scl_prefix}php-pear -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -# posttrans as pear can be installed after us -%posttrans -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -%postun -if [ $1 -eq 0 -a -x %{__pecl} ] ; then - %{pecl_uninstall} %{pecl_name} >/dev/null || : -fi -%endif - - %check cd %{sources} OPT="-n" @@ -168,19 +158,11 @@ REPORT_EXIT_STATUS=1 \ %{__ztsphp} $OPT \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' - -%if %{with tests} -: Upstream test suite for ZTS extension -TEST_PHP_EXECUTABLE=%{__ztsphp} \ -TEST_PHP_ARGS="$OPT -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ -REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php -q --show-diff -%endif %endif %files -%{?_licensedir:%license %{sources}/LICENSE} +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -194,6 +176,14 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Mon Sep 29 2025 Remi Collet <remi@remirepo.net> - 1.5.0-3 +- fix test suite for PHP 8.5.0RC1 using patch from + https://github.com/php-decimal/ext-decimal/pull/89 + +* Fri Sep 26 2025 Remi Collet <remi@remirepo.net> - 1.5.0-2 +- re-license spec file to CECILL-2.1 +- add pie virtual provides (php-decimal/ext-decimal) + * Sat Jan 20 2024 Remi Collet <remi@remirepo.net> - 1.5.0-1 - update to 1.5.0 - build out of sources tree |