diff options
author | Remi Collet <remi@remirepo.net> | 2017-10-13 12:59:47 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-10-13 12:59:47 +0200 |
commit | e1c6ea99720ec4f1f22eca2b28e3fc420ef26c68 (patch) | |
tree | 20aa6e61890b2fb7c580c32532ceabb408b5bb7c /b452b5aa962b21316492c762639b6b4b659c8c6e.patch | |
parent | 2bf0fe79bcfa9d5ed9cdced1fca331e6ed9d6239 (diff) |
add upstream patch for PHP 7.2, FTBFS from Koschei
Diffstat (limited to 'b452b5aa962b21316492c762639b6b4b659c8c6e.patch')
-rw-r--r-- | b452b5aa962b21316492c762639b6b4b659c8c6e.patch | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/b452b5aa962b21316492c762639b6b4b659c8c6e.patch b/b452b5aa962b21316492c762639b6b4b659c8c6e.patch new file mode 100644 index 0000000..c0fe317 --- /dev/null +++ b/b452b5aa962b21316492c762639b6b4b659c8c6e.patch @@ -0,0 +1,193 @@ +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]; + } |