summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--1.patch22
-rw-r--r--b452b5aa962b21316492c762639b6b4b659c8c6e.patch193
-rw-r--r--php-horde-Horde-Date-Parser.spec16
3 files changed, 7 insertions, 224 deletions
diff --git a/1.patch b/1.patch
deleted file mode 100644
index 8fc91ff..0000000
--- a/1.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From 7575d9125f00f03b3ca644f4be6d1857f4311dd2 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Thu, 17 Oct 2019 12:39:10 +0200
-Subject: [PATCH] Fix Trying to access array offset on value of type null
-
----
- lib/Horde/Date/Parser/Token.php | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/Horde/Date/Parser/Token.php b/lib/Horde/Date/Parser/Token.php
-index fcb8537..0d59994 100644
---- a/lib/Horde/Date/Parser/Token.php
-+++ b/lib/Horde/Date/Parser/Token.php
-@@ -74,7 +74,7 @@ function ($t) use ($tagClass) {
- }
- );
- $match = array_shift($matches);
-- return $match[1];
-+ return (is_array($match) ? $match[1] : null);
- }
-
- /**
diff --git a/b452b5aa962b21316492c762639b6b4b659c8c6e.patch b/b452b5aa962b21316492c762639b6b4b659c8c6e.patch
deleted file mode 100644
index c0fe317..0000000
--- a/b452b5aa962b21316492c762639b6b4b659c8c6e.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From b452b5aa962b21316492c762639b6b4b659c8c6e Mon Sep 17 00:00:00 2001
-From: Jan Schneider <jan@horde.org>
-Date: Mon, 13 Feb 2017 18:38:59 +0100
-Subject: [PATCH] Don't use create_function().
-
-It's deprecated and unsafe and closures should be used instead.
----
- lib/Horde/Date/Parser.php | 13 ++++++++++++-
- lib/Horde/Date/Parser/Locale/Base.php | 31 +++++++++++++++++++++++++------
- lib/Horde/Date/Parser/Locale/Pt.php | 4 +++-
- lib/Horde/Date/Parser/Result.php | 16 ++++++++++++----
- lib/Horde/Date/Parser/Token.php | 14 ++++++++++++--
- 5 files changed, 64 insertions(+), 14 deletions(-)
-
-diff --git a/lib/Horde/Date/Parser.php b/lib/Horde/Date/Parser.php
-index b297932..29c542e 100644
---- a/lib/Horde/Date/Parser.php
-+++ b/lib/Horde/Date/Parser.php
-@@ -44,7 +44,18 @@ public static function getLocales()
- foreach (new DirectoryIterator($dir) as $f) {
- if ($f->isFile()) {
- $locale = str_replace('.php', '', $f->getFilename());
-- $locale = preg_replace_callback('/([A-Z][a-z]*)([A-Z].*)?/', create_function('$m', 'if (!isset($m[2])) { return Horde_String::lower($m[1]); } else { return Horde_String::lower($m[1]) . "_" . Horde_String::upper($m[2]); }'), $locale);
-+ $locale = preg_replace_callback(
-+ '/([A-Z][a-z]*)([A-Z].*)?/',
-+ function ($m) {
-+ if (!isset($m[2])) {
-+ return Horde_String::lower($m[1]);
-+ } else {
-+ return Horde_String::lower($m[1])
-+ . '_' . Horde_String::upper($m[2]);
-+ }
-+ },
-+ $locale
-+ );
- $locales[] = $locale;
- }
- }
-diff --git a/lib/Horde/Date/Parser/Locale/Base.php b/lib/Horde/Date/Parser/Locale/Base.php
-index 882e0fc..647b2fc 100644
---- a/lib/Horde/Date/Parser/Locale/Base.php
-+++ b/lib/Horde/Date/Parser/Locale/Base.php
-@@ -97,7 +97,9 @@ public function parse($text, $specifiedOptions = array())
- }
-
- // strip any non-tagged tokens
-- $taggedTokens = array_values(array_filter($tokens, create_function('$t', 'return $t->tagged();')));
-+ $taggedTokens = array_values(array_filter(
-+ $tokens, function ($t) { return $t->tagged(); }
-+ ));
-
- // Remove tokens we know we don't want - for example, if the first token
- // is a separator, drop it.
-@@ -197,7 +199,10 @@ public function numericizeOrdinals($text)
- */
- public function preTokenize($text)
- {
-- return array_map(create_function('$w', 'return new Horde_Date_Parser_Token($w);'), preg_split('/\s+/', $text));
-+ return array_map(
-+ function ($w) { return new Horde_Date_Parser_Token($w); },
-+ preg_split('/\s+/', $text)
-+ );
- }
-
- /**
-@@ -292,7 +297,9 @@ public function tokensToSpan($tokens, $options)
- // maybe it's a specific date
- foreach ($this->definitions['date'] as $handler) {
- if ($handler->match($tokens, $this->definitions)) {
-- $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");')));
-+ $goodTokens = array_values(array_filter(
-+ $tokens, function ($o) { return !$o->getTag('separator'); }
-+ ));
- $this->debug($handler->handlerMethod, $goodTokens, $options);
- return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options);
- }
-@@ -301,7 +308,9 @@ public function tokensToSpan($tokens, $options)
- // I guess it's not a specific date, maybe it's just an anchor
- foreach ($this->definitions['anchor'] as $handler) {
- if ($handler->match($tokens, $this->definitions)) {
-- $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");')));
-+ $goodTokens = array_values(array_filter(
-+ $tokens, function ($o) { return !$o->getTag('separator'); }
-+ ));
- $this->debug($handler->handlerMethod, $goodTokens, $options);
- return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options);
- }
-@@ -310,7 +319,14 @@ public function tokensToSpan($tokens, $options)
- // not an anchor, perhaps it's an arrow
- foreach ($this->definitions['arrow'] as $handler) {
- if ($handler->match($tokens, $this->definitions)) {
-- $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator_at") && !$o->getTag("separator_slash_or_dash") && !$o->getTag("separator_comma");')));
-+ $goodTokens = array_values(array_filter(
-+ $tokens,
-+ function ($o) {
-+ return !$o->getTag('separator_at') &&
-+ !$o->getTag('separator_slash_or_dash') &&
-+ !$o->getTag('separator_comma');
-+ }
-+ ));
- $this->debug($handler->handlerMethod, $goodTokens, $options);
- return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options);
- }
-@@ -603,7 +619,10 @@ public function getRepeaters($tokens)
- }
-
- // Return repeaters in order from widest (years) to smallest (seconds)
-- usort($repeaters, create_function('$a, $b', 'return $b->width() > $a->width();'));
-+ usort(
-+ $repeaters,
-+ function ($a, $b) { return $b->width() > $a->width(); }
-+ );
- return $repeaters;
- }
-
-diff --git a/lib/Horde/Date/Parser/Locale/Pt.php b/lib/Horde/Date/Parser/Locale/Pt.php
-index 79d43b3..f5f2e40 100644
---- a/lib/Horde/Date/Parser/Locale/Pt.php
-+++ b/lib/Horde/Date/Parser/Locale/Pt.php
-@@ -100,7 +100,9 @@ public function parse($text, $specifiedOptions = array())
- }
-
- // strip any non-tagged tokens
-- $taggedTokens = array_values(array_filter($tokens, create_function('$t', 'return $t->tagged();')));
-+ $taggedTokens = array_values(array_filter(
-+ $tokens, function ($t) { return $t->tagged(); }
-+ ));
-
- // Remove tokens we know we don't want - for example, if the first
- // token is a separator, drop it.
-diff --git a/lib/Horde/Date/Parser/Result.php b/lib/Horde/Date/Parser/Result.php
-index 415b77c..859d14a 100644
---- a/lib/Horde/Date/Parser/Result.php
-+++ b/lib/Horde/Date/Parser/Result.php
-@@ -28,14 +28,22 @@ public function guess()
-
- public function taggedText()
- {
-- $taggedTokens = array_values(array_filter($this->tokens, create_function('$t', 'return $t->tagged();')));
-- return implode(' ', array_map(create_function('$t', 'return $t->word;'), $taggedTokens));
-+ $taggedTokens = array_values(array_filter(
-+ $this->tokens, function ($t) { return $t->tagged(); }
-+ ));
-+ return implode(
-+ ' ', array_map(function ($t) { return $t->word; }, $taggedTokens)
-+ );
- }
-
- public function untaggedText()
- {
-- $untaggedTokens = array_values(array_filter($this->tokens, create_function('$t', 'return ! $t->tagged();')));
-- return implode(' ', array_map(create_function('$t', 'return $t->word;'), $untaggedTokens));
-+ $untaggedTokens = array_values(array_filter(
-+ $this->tokens, function ($t) { return !$t->tagged(); }
-+ ));
-+ return implode(
-+ ' ', array_map(function ($t) { return $t->word; }, $untaggedTokens)
-+ );
- }
-
- }
-diff --git a/lib/Horde/Date/Parser/Token.php b/lib/Horde/Date/Parser/Token.php
-index 39aeca4..5e88d74 100644
---- a/lib/Horde/Date/Parser/Token.php
-+++ b/lib/Horde/Date/Parser/Token.php
-@@ -23,7 +23,12 @@ public function tag($tagClass, $tag)
- */
- public function untag($tagClass)
- {
-- $this->tags = array_filter($this->tags, create_function('$t', 'return substr($t[0], 0, ' . strlen($tagClass) . ') != "' . $tagClass . '";'));
-+ $this->tags = array_filter(
-+ $this->tags,
-+ function ($t) use ($tagClass) {
-+ return substr($t[0], 0, strlen($tagClass)) != $tagClass;
-+ }
-+ );
- }
-
- /**
-@@ -39,7 +44,12 @@ public function tagged()
- */
- public function getTag($tagClass)
- {
-- $matches = array_filter($this->tags, create_function('$t', 'return substr($t[0], 0, ' . strlen($tagClass) . ') == "' . $tagClass . '";'));
-+ $matches = array_filter(
-+ $this->tags,
-+ function ($t) use ($tagClass) {
-+ return substr($t[0], 0, strlen($tagClass)) == $tagClass;
-+ }
-+ );
- $match = array_shift($matches);
- return $match[1];
- }
diff --git a/php-horde-Horde-Date-Parser.spec b/php-horde-Horde-Date-Parser.spec
index 1749261..b4d1936 100644
--- a/php-horde-Horde-Date-Parser.spec
+++ b/php-horde-Horde-Date-Parser.spec
@@ -11,17 +11,14 @@
%global pear_channel pear.horde.org
Name: php-horde-Horde-Date-Parser
-Version: 2.0.6
-Release: 9%{?dist}
+Version: 2.0.7
+Release: 1%{?dist}
Summary: Horde Date Parser
License: LGPLv2
URL: http://pear.horde.org
Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
-Patch0: https://github.com/horde/Date_Parser/commit/b452b5aa962b21316492c762639b6b4b659c8c6e.patch
-Patch1: https://patch-diff.githubusercontent.com/raw/horde/Date_Parser/pull/1.patch
-
BuildArch: noarch
BuildRequires: php(language) >= 5.3.0
BuildRequires: php-pear(PEAR) >= 1.7.0
@@ -71,9 +68,6 @@ languages and locales
%prep
%setup -q -c
cd %{pear_name}-%{version}
-%patch0 -p1 -b .upstream
-%patch1 -p1 -b .pr1
-
sed -e '/Parser/s/md5sum=.*name=/name=/' \
../package.xml >%{name}.xml
touch -r ../package.xml %{name}.xml
@@ -102,7 +96,7 @@ cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g)
ret=0
for cmd in php php56 php70 php71 php72 php73 php74; do
if which $cmd; then
- $cmd %{_bindir}/phpunit . || ret=1
+ $cmd %{_bindir}/phpunit --bootstrap=bootstrap.php . || ret=1
fi
done
exit $ret
@@ -128,6 +122,10 @@ fi
%changelog
+* Mon Nov 25 2019 Remi Collet <remi@remirepo.net> - 2.0.7-1
+- update to 2.0.7
+- drop patch merged upstream
+
* Thu Oct 17 2019 Remi Collet <remi@remirepo.net> - 2.0.6-9
- add patch for PHP 7.4 from
https://github.com/horde/Date_Parser/pull/1