summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-03-31 14:03:28 +0200
committerRemi Collet <remi@remirepo.net>2021-03-31 14:03:28 +0200
commit44dca9040727d7c3277dda219d79f4be21c11cf2 (patch)
tree8c95f0af1dfe8d8c60417f414acf88d08878e10e
parent906be05fb5f3b13f19393f185bb3f876cd286105 (diff)
add minimal fix for PHP 8HEADmaster
-rw-r--r--php-jms-serializer-php8.patch30
-rw-r--r--php-jms-serializer.spec27
2 files changed, 47 insertions, 10 deletions
diff --git a/php-jms-serializer-php8.patch b/php-jms-serializer-php8.patch
new file mode 100644
index 0000000..cfe41ab
--- /dev/null
+++ b/php-jms-serializer-php8.patch
@@ -0,0 +1,30 @@
+diff -up ./src/JMS/Serializer/XmlDeserializationVisitor.php.php8 ./src/JMS/Serializer/XmlDeserializationVisitor.php
+--- ./src/JMS/Serializer/XmlDeserializationVisitor.php.php8 2021-03-31 13:54:50.261719313 +0200
++++ ./src/JMS/Serializer/XmlDeserializationVisitor.php 2021-03-31 13:54:57.315695261 +0200
+@@ -48,7 +48,7 @@ class XmlDeserializationVisitor extends
+ $previous = libxml_use_internal_errors(true);
+ libxml_clear_errors();
+
+- $previousEntityLoaderState = libxml_disable_entity_loader($this->disableExternalEntities);
++ $previousEntityLoaderState = @libxml_disable_entity_loader($this->disableExternalEntities);
+
+ if (false !== stripos($data, '<!doctype')) {
+ $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
+@@ -63,7 +63,7 @@ class XmlDeserializationVisitor extends
+ $doc = simplexml_load_string($data);
+
+ libxml_use_internal_errors($previous);
+- libxml_disable_entity_loader($previousEntityLoaderState);
++ @libxml_disable_entity_loader($previousEntityLoaderState);
+
+ if (false === $doc) {
+ throw new XmlErrorException(libxml_get_last_error());
+@@ -176,7 +176,7 @@ class XmlDeserializationVisitor extends
+ $nodes = $data->xpath($entryName);
+ }
+
+- if (!\count($nodes)) {
++ if (!($nodes && \count($nodes))) {
+ if (null === $this->result) {
+ return $this->result = array();
+ }
diff --git a/php-jms-serializer.spec b/php-jms-serializer.spec
index 72dcb87..d8eac31 100644
--- a/php-jms-serializer.spec
+++ b/php-jms-serializer.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-jms-serializer
#
-# Copyright (c) 2017-2020 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2017-2021 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -102,7 +102,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 3%{?github_release}%{?dist}
+Release: 5%{?github_release}%{?dist}
Summary: Library for (de-)serializing data of any complexity
License: MIT
@@ -113,6 +113,9 @@ URL: http://jmsyst.com/libs/serializer
Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
Source1: %{name}-get-source.sh
+# Minimal patch for PHP 8
+Patch0: %{name}-php8.patch
+
BuildArch: noarch
# Tests
%if %{with_tests}
@@ -156,12 +159,19 @@ BuildRequires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver}
BuildRequires: php-composer(psr/container) < %{psr_container_max_ver}
BuildRequires: php-composer(psr/container) >= %{psr_container_min_ver}
BuildRequires: php-composer(symfony/dependency-injection) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/dependency-injection) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/expression-language) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/expression-language) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/filesystem) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/filesystem) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/form) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/form) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/translation) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/translation) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/validator) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/validator) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/yaml) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/yaml) >= %{symfony_min_ver}
BuildRequires: php-composer(twig/twig) < %{twig_max_ver}
BuildRequires: php-composer(twig/twig) >= %{twig_min_ver}
%endif
@@ -246,6 +256,7 @@ Autoloader: %{phpdir}/JMS/Serializer/autoload.php
%prep
%setup -qn %{github_name}-%{github_commit}
+%patch0 -p1
: Remove Propel
find . -type f -name '*Propel*' -delete -print
@@ -364,15 +375,8 @@ sed 's/function testInlineArray/function SKIP_testInlineArray/' \
: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit)
-for PHP_EXEC in php php72 php73 php74; do
+for PHP_EXEC in php php73 php74 php80; do
if [ "php" = "$PHP_EXEC" ] || which $PHP_EXEC; then
- if [ $($PHP_EXEC -r 'echo PHP_VERSION_ID;') -lt 70200 ]; then
- sed \
- -e 's/function testArrayFloats/function SKIP_testArrayFloats/' \
- -e 's/function testCurrencyAwarePrice/function SKIP_testCurrencyAwarePrice/' \
- -i tests/Serializer/BaseSerializationTest.php
- fi
-
$PHP_EXEC $PHPUNIT --bootstrap bootstrap.php || RETURN_CODE=1
fi
done
@@ -391,6 +395,9 @@ exit $RETURN_CODE
%changelog
+* Wed Mar 31 2021 Remi Collet <remi@remirepo.net> - 1.14.1-5
+- add minimal fix for PHP 8
+
* Tue Aug 18 2020 Shawn Iwinski <shawn@iwin.ski> - 1.14.1-3
- Bumping release to ensure all changes are built