From 8f35cf863c648b721fe2cc0c788e1f77165e88cf Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 13 Oct 2019 07:46:38 +0200 Subject: - update to 2.11.3 - drop patches merged upstream --- 192.patch | 28 ------- 195.patch | 155 --------------------------------------- composer.json | 38 ++++++---- php-zendframework-zend-view.spec | 15 ++-- 4 files changed, 29 insertions(+), 207 deletions(-) delete mode 100644 192.patch delete mode 100644 195.patch diff --git a/192.patch b/192.patch deleted file mode 100644 index 7385eff..0000000 --- a/192.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 26679ddafc593e5163df30e98d3ce98b764aa13f Mon Sep 17 00:00:00 2001 -From: webimpress -Date: Tue, 27 Aug 2019 23:29:41 +0100 -Subject: [PATCH] Fix: replace curly offset access brace with square brackets - -As of PHP 7.4: -the array and string offset access syntax using curly braces is deprecated. ---- - src/Helper/Navigation/Sitemap.php | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/Helper/Navigation/Sitemap.php b/src/Helper/Navigation/Sitemap.php -index 76acb227..08aa922e 100644 ---- a/src/Helper/Navigation/Sitemap.php -+++ b/src/Helper/Navigation/Sitemap.php -@@ -267,10 +267,10 @@ public function url(AbstractPage $page) - { - $href = $page->getHref(); - -- if (! isset($href{0})) { -+ if (! isset($href[0])) { - // no href - return ''; -- } elseif ($href{0} == '/') { -+ } elseif ($href[0] == '/') { - // href is relative to root; use serverUrl helper - $url = $this->getServerUrl() . $href; - } elseif (preg_match('/^[a-z]+:/im', (string) $href)) { diff --git a/195.patch b/195.patch deleted file mode 100644 index 6ccd989..0000000 --- a/195.patch +++ /dev/null @@ -1,155 +0,0 @@ -From cd691f9a6e3f97812c98e7385208e3dc3661bb4d Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 10 Oct 2019 10:57:31 +0200 -Subject: [PATCH 1/3] fix Using array_key_exists() on objects - ---- - src/Model/ViewModel.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Model/ViewModel.php b/src/Model/ViewModel.php -index 04e76498..6c330dab 100644 ---- a/src/Model/ViewModel.php -+++ b/src/Model/ViewModel.php -@@ -239,7 +239,7 @@ public function clearOptions() - public function getVariable($name, $default = null) - { - $name = (string) $name; -- if (array_key_exists($name, $this->variables)) { -+ if (isset($this->variables[$name])) { - return $this->variables[$name]; - } - - -From c711fbddaedc322cf5cbdfaa5f4dce8c201e35d7 Mon Sep 17 00:00:00 2001 -From: webimpress -Date: Thu, 10 Oct 2019 23:01:54 +0100 -Subject: [PATCH 2/3] Fixes failing tests on PHP 7.4 - -From PHP 7.4 docs: - - Calling get_object_vars() on an ArrayObject instance will now always return - the properties of the ArrayObject itself (or a subclass). Previously it - returned the values of the wrapped array/object unless the STD_PROP_LIST - flag was specified. Other affected operations are: - - * ReflectionObject::getProperties() - * reset(), current(), etc. Use Iterator methods instead. - * Potentially others working on object properties as a list. ---- - .../application/views/scripts/partialLoopChildObject.phtml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/Helper/_files/modules/application/views/scripts/partialLoopChildObject.phtml b/test/Helper/_files/modules/application/views/scripts/partialLoopChildObject.phtml -index e5babd65..1463771b 100644 ---- a/test/Helper/_files/modules/application/views/scripts/partialLoopChildObject.phtml -+++ b/test/Helper/_files/modules/application/views/scripts/partialLoopChildObject.phtml -@@ -1,12 +1,12 @@ - vars(); -+$vars = (array) $this->vars(); - - if (empty($vars)) { - echo "No object model passed"; - } elseif (isset($vars['message'])) { - echo $vars['message']; - } else { -- $objKey = current($this->vars())->helper->getObjectKey(); -+ $objKey = current($vars)->helper->getObjectKey(); - echo 'This is an iteration with objectKey: ' . $objKey; - } - -From 81ed6ca3c83f295fabdb67f7d9e5e2c9de0a41be Mon Sep 17 00:00:00 2001 -From: webimpress -Date: Thu, 10 Oct 2019 23:08:36 +0100 -Subject: [PATCH 3/3] Correct the fix so the behaviour of the original code is - not changed - -Added tests to verify the change. ---- - src/Model/ViewModel.php | 9 +++++-- - test/Model/ViewModelTest.php | 52 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 59 insertions(+), 2 deletions(-) - -diff --git a/src/Model/ViewModel.php b/src/Model/ViewModel.php -index 6c330dab..5609a091 100644 ---- a/src/Model/ViewModel.php -+++ b/src/Model/ViewModel.php -@@ -239,8 +239,13 @@ public function clearOptions() - public function getVariable($name, $default = null) - { - $name = (string) $name; -- if (isset($this->variables[$name])) { -- return $this->variables[$name]; -+ -+ if (is_array($this->variables)) { -+ if (array_key_exists($name, $this->variables)) { -+ return $this->variables[$name]; -+ } -+ } elseif ($this->variables->offsetExists($name)) { -+ return $this->variables->offsetGet($name); - } - - return $default; -diff --git a/test/Model/ViewModelTest.php b/test/Model/ViewModelTest.php -index 318825f8..e922a0e8 100644 ---- a/test/Model/ViewModelTest.php -+++ b/test/Model/ViewModelTest.php -@@ -361,4 +361,56 @@ public function testCloneWithArray() - $this->assertEquals('foo', $model1->getVariable('a')); - $this->assertEquals('bar', $model2->getVariable('a')); - } -+ -+ public function variableValue() -+ { -+ return [ -+ // variables default expected -+ -+ // if it is set always get the value -+ [['foo' => 'bar'], 'baz', 'bar'], -+ [['foo' => 'bar'], null, 'bar'], -+ [new ArrayObject(['foo' => 'bar']), 'baz', 'bar'], -+ [new ArrayObject(['foo' => 'bar']), null, 'bar'], -+ -+ // if it is null always get null value -+ [['foo' => null], null, null], -+ [['foo' => null], 'baz', null], -+ [new ArrayObject(['foo' => null]), null, null], -+ [new ArrayObject(['foo' => null]), 'baz', null], -+ -+ // when it is not set always get default value -+ [[], 'baz', 'baz'], -+ [new ArrayObject(), 'baz', 'baz'], -+ ]; -+ } -+ -+ /** -+ * @dataProvider variableValue -+ * -+ * @param array|ArrayObject $variables -+ * @param string|null $default -+ * @param string|null $expected -+ */ -+ public function testGetVariableSetByConstruct($variables, $default, $expected) -+ { -+ $model = new ViewModel($variables); -+ -+ self::assertSame($expected, $model->getVariable('foo', $default)); -+ } -+ -+ /** -+ * @dataProvider variableValue -+ * -+ * @param array|ArrayObject $variables -+ * @param string|null $default -+ * @param string|null $expected -+ */ -+ public function testGetVariableSetBySetter($variables, $default, $expected) -+ { -+ $model = new ViewModel(); -+ $model->setVariables($variables); -+ -+ self::assertSame($expected, $model->getVariable('foo', $default)); -+ } - } diff --git a/composer.json b/composer.json index b9eaf23..58091f1 100644 --- a/composer.json +++ b/composer.json @@ -1,16 +1,19 @@ { "name": "zendframework/zend-view", - "description": "provides a system of helpers, output filters, and variable escaping", + "description": "Flexible view layer supporting and providing multiple view layers, helpers, and more", "license": "BSD-3-Clause", "keywords": [ - "zf2", + "zendframework", + "zf", "view" ], - "homepage": "https://github.com/zendframework/zend-view", - "autoload": { - "psr-4": { - "Zend\\View\\": "src/" - } + "support": { + "docs": "https://docs.zendframework.com/zend-view/", + "issues": "https://github.com/zendframework/zend-view/issues", + "source": "https://github.com/zendframework/zend-view", + "rss": "https://github.com/zendframework/zend-view/releases.atom", + "chat": "https://zendframework-slack.herokuapp.com", + "forum": "https://discourse.zendframework.com/c/questions/components" }, "require": { "php": "^5.6 || ^7.0", @@ -58,15 +61,9 @@ "zendframework/zend-servicemanager": "Zend\\ServiceManager component", "zendframework/zend-uri": "Zend\\Uri component" }, - "minimum-stability": "dev", - "prefer-stable": true, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "2.11.x-dev", - "dev-develop": "2.12.x-dev" + "autoload": { + "psr-4": { + "Zend\\View\\": "src/" } }, "autoload-dev": { @@ -77,6 +74,15 @@ "ZendTest\\View\\": "test/" } }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "2.11.x-dev", + "dev-develop": "2.12.x-dev" + } + }, "bin": [ "bin/templatemap_generator.php" ], diff --git a/php-zendframework-zend-view.spec b/php-zendframework-zend-view.spec index 9eab1aa..8c13a28 100644 --- a/php-zendframework-zend-view.spec +++ b/php-zendframework-zend-view.spec @@ -7,7 +7,7 @@ # Please, preserve the changelog entries # %global bootstrap 0 -%global gh_commit 4f5cb653ed4c64bb8d9bf05b294300feb00c67f2 +%global gh_commit e766457bd6ce13c5354e443bb949511b6904d7f5 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner zendframework %global gh_project zend-view @@ -20,8 +20,8 @@ %endif Name: php-%{gh_owner}-%{gh_project} -Version: 2.11.2 -Release: 3%{?dist} +Version: 2.11.3 +Release: 1%{?dist} Summary: Zend Framework %{library} component License: BSD @@ -29,9 +29,6 @@ URL: https://zendframework.github.io/%{gh_project}/ Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz Source1: makesrc.sh -Patch0: https://patch-diff.githubusercontent.com/raw/zendframework/zend-view/pull/195.patch -Patch1: https://patch-diff.githubusercontent.com/raw/zendframework/zend-view/pull/192.patch - BuildArch: noarch # Tests %if %{with_tests} @@ -216,8 +213,6 @@ Documentation: https://zendframework.github.io/%{gh_project}/ %prep %setup -q -n %{gh_project}-%{gh_commit} -%patch0 -p1 -%patch1 -p1 mv LICENSE.md LICENSE @@ -309,6 +304,10 @@ exit $ret %changelog +* Sun Oct 13 2019 Remi Collet - 2.11.3-1 +- update to 2.11.3 +- drop patches merged upstream + * Fri Oct 11 2019 Remi Collet - 2.11.2-3 - add patches for PHP 7.4 from https://github.com/zendframework/zend-view/pull/192 -- cgit