From ea063ea83179e8b27a5f1c1eda8b79688206d8db Mon Sep 17 00:00:00 2001 From: Aleksei Khudiakov Date: Mon, 8 Jan 2018 12:54:35 +1000 Subject: [PATCH 01/60] Add EOL templates --- ISSUE_TEMPLATE | 4 ++++ PULL_REQUEST_TEMPLATE | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 ISSUE_TEMPLATE create mode 100644 PULL_REQUEST_TEMPLATE diff --git a/ISSUE_TEMPLATE b/ISSUE_TEMPLATE new file mode 100644 index 0000000000..78bc4a137e --- /dev/null +++ b/ISSUE_TEMPLATE @@ -0,0 +1,4 @@ +Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. +No Pull Requests will be accepted. + +https://framework.zend.com/blog/2016-06-28-zf11-eol.html diff --git a/PULL_REQUEST_TEMPLATE b/PULL_REQUEST_TEMPLATE new file mode 100644 index 0000000000..78bc4a137e --- /dev/null +++ b/PULL_REQUEST_TEMPLATE @@ -0,0 +1,4 @@ +Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. +No Pull Requests will be accepted. + +https://framework.zend.com/blog/2016-06-28-zf11-eol.html From d31af76036c9b95eea00f1d3ec4d4262cce2fbf2 Mon Sep 17 00:00:00 2001 From: Aleksei Khudiakov Date: Mon, 5 Feb 2018 16:01:35 +1000 Subject: [PATCH 02/60] Fix eol url --- ISSUE_TEMPLATE | 2 +- PULL_REQUEST_TEMPLATE | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ISSUE_TEMPLATE b/ISSUE_TEMPLATE index 78bc4a137e..f0289361e5 100644 --- a/ISSUE_TEMPLATE +++ b/ISSUE_TEMPLATE @@ -1,4 +1,4 @@ Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. No Pull Requests will be accepted. -https://framework.zend.com/blog/2016-06-28-zf11-eol.html +https://framework.zend.com/blog/2016-06-28-zf1-eol.html diff --git a/PULL_REQUEST_TEMPLATE b/PULL_REQUEST_TEMPLATE index 78bc4a137e..f0289361e5 100644 --- a/PULL_REQUEST_TEMPLATE +++ b/PULL_REQUEST_TEMPLATE @@ -1,4 +1,4 @@ Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. No Pull Requests will be accepted. -https://framework.zend.com/blog/2016-06-28-zf11-eol.html +https://framework.zend.com/blog/2016-06-28-zf1-eol.html From 136735e776f520b081cd374012852cb88cef9a88 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 16 May 2018 10:48:08 -0500 Subject: [PATCH 03/60] EOL! Archived! --- CONTRIBUTING.md | 10 +++------- DEVELOPMENT_README.md | 9 ++++++++- README-GIT.md | 7 +++++++ README.md | 10 ++++------ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c864e957bb..f76f6b2975 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,9 @@ # CONTRIBUTING -> ## End-of-Life occurs 28 Sep 2016 +> ## End-of-Life occurred 28 Sep 2016 > -> Between now and 28 Sep 2016, we will only be accepting security patches to -> this repository; after that date, we will issue no more releases. -> -> For more information: -> -> - https://framework.zend.com/blog/2016-06-28-zf1-eol.html +> This project is no longer maintained, and reached its end of life on 28 Sep +> 2016; the last public release was 1.12.20. --- diff --git a/DEVELOPMENT_README.md b/DEVELOPMENT_README.md index 24195b52fc..074d741dcb 100644 --- a/DEVELOPMENT_README.md +++ b/DEVELOPMENT_README.md @@ -1,5 +1,12 @@ # Development using a virtual machine +> ## End-of-Life occurred 28 Sep 2016 +> +> This project is no longer maintained, and reached its end of life on 28 Sep +> 2016; the last public release was 1.12.20. +> +> At this time, the repository has been archived, and is read-only. + You can set up a development virtual machine for ZF1 unit testing and library development following these simple instructions. @@ -60,4 +67,4 @@ To stop the VM do one of the following: Also, when any of of the Puppet manifests change (.pp files), it is a good idea to rerun them: - vagrant provision \ No newline at end of file + vagrant provision diff --git a/README-GIT.md b/README-GIT.md index 892565a4ca..879bc4143c 100755 --- a/README-GIT.md +++ b/README-GIT.md @@ -1,5 +1,12 @@ # USING THE GIT REPOSITORY +> ## End-of-Life occurred 28 Sep 2016 +> +> This project is no longer maintained, and reached its end of life on 28 Sep +> 2016; the last public release was 1.12.20. +> +> At this time, the repository has been archived, and is read-only. + ## Setup your own public repository Your first step is to establish a public repository from which we can diff --git a/README.md b/README.md index b6f5aa0a09..0d18637baf 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ ![Logo](http://framework.zend.com/images/logos/ZendFramework-logo.png) -> ## End-of-Life occurs 28 Sep 2016 +> ## End-of-Life occurred 28 Sep 2016 > -> Between now and 28 Sep 2016, we will only be accepting security patches to -> this repository; after that date, we will issue no more releases. +> This project is no longer maintained, and reached its end of life on 28 Sep +> 2016; the last public release was 1.12.20. > -> For more information: -> -> - https://framework.zend.com/blog/2016-06-28-zf1-eol.html +> At this time, the repository has been archived, and is read-only. --- From 527935239a600c8a1456ee904dc237e70898d6f3 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 23 Jul 2018 09:26:21 +0100 Subject: [PATCH 04/60] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eb84b09649..56a6d13a95 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "zendframework/zendframework1", + "name": "zendframework/zendframework1-PHP7.2", "description": "Zend Framework 1", "type": "library", "keywords": [ From 8850fc0f3af9d5c219cbae0d90a189f76b581c20 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 23 Jul 2018 09:28:26 +0100 Subject: [PATCH 05/60] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 56a6d13a95..78646b736d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "zendframework/zendframework1-PHP7.2", - "description": "Zend Framework 1", + "name": "zendframework/zendframework1-php7.2", + "description": "Zend Framework 1 PHP7.2 compatible", "type": "library", "keywords": [ "framework", From ff438d0a9562ccfa2ce837380c615c169d62f944 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 23 Jul 2018 09:32:50 +0100 Subject: [PATCH 06/60] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 78646b736d..4bb24a34a0 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "zendframework/zendframework1-php7.2", + "name": "shardj/zendframework1-php7.2", "description": "Zend Framework 1 PHP7.2 compatible", "type": "library", "keywords": [ From 47e5c238925a7fe5cc7521ae20923c48d6470588 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 23 Jul 2018 11:12:02 +0100 Subject: [PATCH 07/60] Update Abstract.php Count issue fix --- library/Zend/Db/Table/Abstract.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/Zend/Db/Table/Abstract.php b/library/Zend/Db/Table/Abstract.php index 66aa60545a..e4b213083a 100644 --- a/library/Zend/Db/Table/Abstract.php +++ b/library/Zend/Db/Table/Abstract.php @@ -1304,7 +1304,11 @@ public function find() $whereList = array(); $numberTerms = 0; foreach ($args as $keyPosition => $keyValues) { - $keyValuesCount = count($keyValues); + if (is_array($keyValues) || $keyValues instanceof Countable) { + $keyValuesCount = count($keyValues); + } else { + $keyValuesCount = 1; + } // Coerce the values to an array. // Don't simply typecast to array, because the values // might be Zend_Db_Expr objects. From 1409c15c8e9e482b555bdbd671ae2d81372d3fec Mon Sep 17 00:00:00 2001 From: George Appleton Date: Mon, 23 Jul 2018 11:35:00 +0100 Subject: [PATCH 08/60] added null case to php 7.2 patch --- library/Zend/Db/Table/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Table/Abstract.php b/library/Zend/Db/Table/Abstract.php index e4b213083a..2f2f60a3c8 100644 --- a/library/Zend/Db/Table/Abstract.php +++ b/library/Zend/Db/Table/Abstract.php @@ -1307,7 +1307,7 @@ public function find() if (is_array($keyValues) || $keyValues instanceof Countable) { $keyValuesCount = count($keyValues); } else { - $keyValuesCount = 1; + $keyValuesCount = $keyValues == null ? 0 : 1; } // Coerce the values to an array. // Don't simply typecast to array, because the values From 3e9b26c748282204a3d5193aac5c948cac40c1da Mon Sep 17 00:00:00 2001 From: George Appleton Date: Mon, 23 Jul 2018 16:21:05 +0100 Subject: [PATCH 09/60] removed usages of depricated each() --- demos/Zend/Mobile/Push/ApnsFeedback.php | 6 +++--- .../manual/en/module_specs/Zend_Mobile_Push-Apns.xml | 4 ++-- library/Zend/Cache/Backend.php | 2 +- library/Zend/Config/Yaml.php | 6 +++--- .../Http/UserAgent/Features/Adapter/TeraWurfl.php | 2 +- library/Zend/XmlRpc/Value.php | 4 ++-- tests/Zend/XmlRpc/RequestTest.php | 12 ++---------- tests/runalltests.php | 4 ++-- 8 files changed, 16 insertions(+), 24 deletions(-) diff --git a/demos/Zend/Mobile/Push/ApnsFeedback.php b/demos/Zend/Mobile/Push/ApnsFeedback.php index e2b5489eb0..79c07622e0 100644 --- a/demos/Zend/Mobile/Push/ApnsFeedback.php +++ b/demos/Zend/Mobile/Push/ApnsFeedback.php @@ -3,7 +3,7 @@ $apns = new Zend_Mobile_Push_Apns(); $apns->setCertificate('/path/to/provisioning-certificate.pem'); - + try { $apns->connect(Zend_Mobile_Push_Apns::SERVER_FEEDBACK_SANDBOX_URI); } catch (Zend_Mobile_Push_Exception_ServerUnavailable $e) { @@ -13,9 +13,9 @@ echo 'APNS Connection Error:' . $e->getMessage(); exit(1); } - + $tokens = $apns->feedback(); -while(list($token, $time) = each($tokens)) { +foreach ($tokens as $token => $time) { echo $time . "\t" . $token . PHP_EOL; } $apns->close(); diff --git a/documentation/manual/en/module_specs/Zend_Mobile_Push-Apns.xml b/documentation/manual/en/module_specs/Zend_Mobile_Push-Apns.xml index 7aa51c29be..f21f15d992 100644 --- a/documentation/manual/en/module_specs/Zend_Mobile_Push-Apns.xml +++ b/documentation/manual/en/module_specs/Zend_Mobile_Push-Apns.xml @@ -152,12 +152,12 @@ try { } $tokens = $apns->feedback(); -while(list($token, $time) = each($tokens)) { +foreach ($tokens as $token => $time) { echo $time . "\t" . $token . PHP_EOL; } $apns->close(); ]]> - + diff --git a/library/Zend/Cache/Backend.php b/library/Zend/Cache/Backend.php index 83f1af5f12..3d99e0939c 100644 --- a/library/Zend/Cache/Backend.php +++ b/library/Zend/Cache/Backend.php @@ -76,7 +76,7 @@ public function __construct(array $options = array()) public function setDirectives($directives) { if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array'); - while (list($name, $value) = each($directives)) { + foreach ($directives as $name => $value) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name : $name"); } diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 0d107033eb..7b2fbcd169 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -202,7 +202,7 @@ public function __construct($yaml, $section = null, $options = false) if (!isset($config[$sectionName])) { require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception(sprintf( - 'Section "%s" cannot be found', + 'Section "%s" cannot be found', implode(' ', (array)$section) )); } @@ -214,7 +214,7 @@ public function __construct($yaml, $section = null, $options = false) if (!isset($config[$section])) { require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception(sprintf( - 'Section "%s" cannot be found', + 'Section "%s" cannot be found', implode(' ', (array)$section) )); } @@ -289,7 +289,7 @@ protected static function _decodeYaml($currentIndent, &$lines) { $config = array(); $inIndent = false; - while (list($n, $line) = each($lines)) { + foreach ($line as $n => $line) { $lineno = $n + 1; $line = rtrim(preg_replace("/#.*$/", "", $line)); diff --git a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php index b23dc29d71..4448ed5d0e 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php @@ -88,7 +88,7 @@ public static function getAllCapabilities(TeraWurfl $wurflObj) if (!is_array($group)) { continue; } - while (list ($key, $value) = each($group)) { + foreach ($group as $key => $value) { if (is_bool($value)) { // to have the same type than the official WURFL API $features[$key] = ($value ? 'true' : 'false'); diff --git a/library/Zend/XmlRpc/Value.php b/library/Zend/XmlRpc/Value.php index 6b22449964..d9697a69a2 100644 --- a/library/Zend/XmlRpc/Value.php +++ b/library/Zend/XmlRpc/Value.php @@ -486,13 +486,13 @@ protected static function _createSimpleXMLElement(&$xml) */ protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$value) { - list($type, $value) = each($xml); + [$type, $value] = [key($xml), current($xml)]; if (!$type and $value === null) { $namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions'); foreach ($namespaces as $namespaceName => $namespaceUri) { $namespaceXml = $xml->children($namespaceUri); - list($type, $value) = each($namespaceXml); + [$type, $value] = [key($namespaceXml), current($namespaceXml)]; if ($type !== null) { $type = $namespaceName . ':' . $type; break; diff --git a/tests/Zend/XmlRpc/RequestTest.php b/tests/Zend/XmlRpc/RequestTest.php index dec3f4075c..c86bee6aa0 100644 --- a/tests/Zend/XmlRpc/RequestTest.php +++ b/tests/Zend/XmlRpc/RequestTest.php @@ -287,18 +287,10 @@ protected function _testXmlRequest($xml, $argv) } $result = $sx->xpath('//methodName'); - $count = 0; - while (list( , $node) = each($result)) { - ++$count; - } - $this->assertEquals(1, $count, $xml); + $this->assertEquals(1, count($result), $xml); $result = $sx->xpath('//params'); - $count = 0; - while (list( , $node) = each($result)) { - ++$count; - } - $this->assertEquals(1, $count, $xml); + $this->assertEquals(1, count($result), $xml); try { $methodName = (string) $sx->methodName; diff --git a/tests/runalltests.php b/tests/runalltests.php index f226fb2398..979ed90f2f 100755 --- a/tests/runalltests.php +++ b/tests/runalltests.php @@ -58,7 +58,7 @@ $result = 0; // run through phpunit -while(list(, $file)=each($files)) { +foreach ($files as $file) { if ($_SERVER['TRAVIS_PHP_VERSION'] == 'hhvm' && $file == 'Zend/CodeGenerator/AllTests.php') { echo "Skipping $file on HHVM" . PHP_EOL; //gets stuck on the HHVM continue; @@ -68,7 +68,7 @@ system($PHPUNIT . ' --stderr -d memory_limit=-1 -d error_reporting=E_ALL\&E_STRICT -d display_errors=1 ' . escapeshellarg($file), $c_result); echo PHP_EOL; echo "Finished executing {$file}" . PHP_EOL; - + if ($c_result) { echo PHP_EOL . "Result of $file is $c_result" . PHP_EOL . PHP_EOL; $result = $c_result; From 52b27cb95376d358b8ab8c266c179eaa803d4909 Mon Sep 17 00:00:00 2001 From: George Appleton Date: Mon, 23 Jul 2018 16:30:45 +0100 Subject: [PATCH 10/60] removed another bad usage of count() --- library/Zend/Config/Yaml.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 7b2fbcd169..9811fda862 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -362,11 +362,11 @@ protected static function _parseValue($value) $value = trim($value); // remove quotes from string. - if ('"' == $value['0']) { - if ('"' == $value[count($value) -1]) { + if ('"' == substr($value, 0, 1)) { + if ('"' == substr($value, -1)) { $value = substr($value, 1, -1); } - } elseif ('\'' == $value['0'] && '\'' == $value[count($value) -1]) { + } elseif ('\'' == substr($value, 0, 1) && '\'' == substr($value, -1)) { $value = strtr($value, array("''" => "'", "'" => '')); } From b1377041af0246ae3ec31e3d2fdbcf94bfe8d834 Mon Sep 17 00:00:00 2001 From: George Appleton Date: Mon, 23 Jul 2018 16:38:08 +0100 Subject: [PATCH 11/60] removing uses of depricated function create_function() --- .../Zend_View-Helpers-Navigation.xml | 2 +- .../Zend_View-Helpers-Navigation.xml | 18 +++++------ library/Zend/Feed/Element.php | 2 +- tests/Zend/Form/FormTest.php | 32 +++++++++---------- tests/Zend/Gdata/AppTest.php | 8 ++--- .../Navigation/_files/mvc/views/bc.phtml | 4 +-- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/documentation/manual/de/module_specs/Zend_View-Helpers-Navigation.xml b/documentation/manual/de/module_specs/Zend_View-Helpers-Navigation.xml index 61d94ff27e..a272ba2c4b 100644 --- a/documentation/manual/de/module_specs/Zend_View-Helpers-Navigation.xml +++ b/documentation/manual/de/module_specs/Zend_View-Helpers-Navigation.xml @@ -756,7 +756,7 @@ echo $this->navigation()->breadcrumbs() getLabel();'), + function ($a) { return $a->getLabel(); }, $this->pages)); ]]> diff --git a/documentation/manual/en/module_specs/Zend_View-Helpers-Navigation.xml b/documentation/manual/en/module_specs/Zend_View-Helpers-Navigation.xml index a10299bfaa..b3c032b309 100644 --- a/documentation/manual/en/module_specs/Zend_View-Helpers-Navigation.xml +++ b/documentation/manual/en/module_specs/Zend_View-Helpers-Navigation.xml @@ -762,7 +762,7 @@ echo $this->navigation()->breadcrumbs() getLabel();'), + function ($a) { return $a->getLabel(); }, $this->pages)); ]]> @@ -1261,10 +1261,10 @@ Output: should be rendered. - + - {get|set}ExpandSiblingNodesOfActiveBranch() + {get|set}ExpandSiblingNodesOfActiveBranch() gets/sets a flag specifying whether the sibling nodes of all nodes in the active branch should also be expanded and rendered. @@ -1380,8 +1380,8 @@ Output: - expandSiblingNodesOfActiveBranch; - whether the sibling nodes of nodes in the active + expandSiblingNodesOfActiveBranch; + whether the sibling nodes of nodes in the active branch should be expanded and rendered. Expects a Boolean value. @@ -1823,7 +1823,7 @@ Output: ]]> - + Rendering a custom menu using a partial view script @@ -1862,10 +1862,10 @@ foreach ($this->container as $page) { Community ]]> - + - Rendering only the active branch and all siblings of the active branch + Rendering only the active branch and all siblings of the active branch navigation() ]]> - + diff --git a/library/Zend/Feed/Element.php b/library/Zend/Feed/Element.php index 6e8ffde88b..9376c2551a 100644 --- a/library/Zend/Feed/Element.php +++ b/library/Zend/Feed/Element.php @@ -193,7 +193,7 @@ public function __get($var) if ($length == 1) { return new Zend_Feed_Element($nodes[0]); } elseif ($length > 1) { - return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes); + return array_map(function ($e) { return new Zend_Feed_Element($e); }, $nodes); } else { // When creating anonymous nodes for __set chaining, don't // call appendChild() on them. Instead we pass the current diff --git a/tests/Zend/Form/FormTest.php b/tests/Zend/Form/FormTest.php index 75fbeb65f0..0e271c0116 100644 --- a/tests/Zend/Form/FormTest.php +++ b/tests/Zend/Form/FormTest.php @@ -2790,9 +2790,9 @@ public function testErrorMessagesFromProcessAjaxAreLocalizedWhenTranslateAdapter */ public function _setup9697() { - $callback = create_function('$value, $options', - 'return (isset($options["bar"]["quo"]["foo"]) && - "foo Value" === $options["bar"]["quo"]["foo"]);'); + $callback = function($value, $options) { + return (isset($options["bar"]["quo"]["foo"]) && "foo Value" === $options["bar"]["quo"]["foo"]); + }; $this->form->addElement('text', 'foo') ->foo->setBelongsTo('bar[quo]'); @@ -4596,7 +4596,7 @@ public function testIfViewIsSetInTime() } $this->assertNotEquals($result,''); } - + /** * @group ZF-11088 */ @@ -4608,7 +4608,7 @@ public function testAddErrorOnElementMakesFormInvalidAndReturnsCustomError() $errorMessages = $element->getErrorMessages(); $this->assertSame(1, count($errorMessages)); $this->assertSame($errorString, $errorMessages[0]); - + $element2 = new Zend_Form_Element_Text('bar'); $this->form->addElement($element2); $this->form->getElement('bar')->addError($errorString); @@ -4616,7 +4616,7 @@ public function testAddErrorOnElementMakesFormInvalidAndReturnsCustomError() $this->assertSame(1, count($errorMessages2)); $this->assertSame($errorString, $errorMessages2[0]); } - + /** * @group ZF-10865 * @expectedException Zend_Form_Exception @@ -4644,7 +4644,7 @@ public function testDashSeparatedElementsInDisplayGroupsShouldNotRenderOutsideDi $count = substr_count($html, 'randomelementname-element'); $this->assertEquals(1, $count, $html); } - + /** * @group ZF-11831 */ @@ -4659,7 +4659,7 @@ public function testElementsOfSubFormReceiveCorrectDefaultTranslator() 'locale' => 'en' )); Zend_Registry::set('Zend_Translate', $trDefault); - + // Translator to use for elements $trElement = new Zend_Translate(array( 'adapter' => 'array', @@ -4669,14 +4669,14 @@ public function testElementsOfSubFormReceiveCorrectDefaultTranslator() 'locale' => 'en' )); Zend_Validate_Abstract::setDefaultTranslator($trElement); - + // Change the form's translator $form = new Zend_Form(); $form->addElement(new Zend_Form_Element_Text('foo', array( 'required' => true, 'validators' => array('NotEmpty') ))); - + // Create a subform with it's own validator $sf1 = new Zend_Form_SubForm(); $sf1->addElement(new Zend_Form_Element_Text('foosub', array( @@ -4684,20 +4684,20 @@ public function testElementsOfSubFormReceiveCorrectDefaultTranslator() 'validators' => array('NotEmpty') ))); $form->addSubForm($sf1, 'Test1'); - + $form->isValid(array()); $messages = $form->getMessages(); $this->assertEquals( - 'Element', - @$messages['foo'][Zend_Validate_NotEmpty::IS_EMPTY], + 'Element', + @$messages['foo'][Zend_Validate_NotEmpty::IS_EMPTY], 'Form element received wrong validator' ); $this->assertEquals( - 'Element', - @$messages['Test1']['foosub'][Zend_Validate_NotEmpty::IS_EMPTY], + 'Element', + @$messages['Test1']['foosub'][Zend_Validate_NotEmpty::IS_EMPTY], 'SubForm element received wrong validator' - ); + ); } /** diff --git a/tests/Zend/Gdata/AppTest.php b/tests/Zend/Gdata/AppTest.php index 0b02b5d87d..b4d1c56654 100644 --- a/tests/Zend/Gdata/AppTest.php +++ b/tests/Zend/Gdata/AppTest.php @@ -598,8 +598,8 @@ public function testMagicConstructorsPropogateMinorVersion() { /** * When error handler is overridden to throw an ErrorException, the extension loader - * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the - * first extension directory even if it exists in subsequent ones. This test + * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the + * first extension directory even if it exists in subsequent ones. This test * enforces a fix that keeps this from happening * * @group ZF-12268 @@ -608,8 +608,8 @@ public function testMagicConstructorsPropogateMinorVersion() { public function testLoadExtensionCausesFatalErrorWhenErrorHandlerIsOverridden() { // Override the error handler to throw an ErrorException - set_error_handler(create_function('$a, $b, $c, $d', 'throw new ErrorException($b, 0, $a, $c, $d);'), E_ALL); - try { + set_error_handler(function($a, $b, $c, $d) { throw new ErrorException($b, 0, $a, $c, $d); }, E_ALL); + try { $eq = $this->service->newEventQuery(); restore_error_handler(); $this->assertTrue($eq instanceof Zend_Gdata_Calendar_EventQuery); diff --git a/tests/Zend/View/Helper/Navigation/_files/mvc/views/bc.phtml b/tests/Zend/View/Helper/Navigation/_files/mvc/views/bc.phtml index dc66a5619f..8f683a4e4f 100644 --- a/tests/Zend/View/Helper/Navigation/_files/mvc/views/bc.phtml +++ b/tests/Zend/View/Helper/Navigation/_files/mvc/views/bc.phtml @@ -1,4 +1,4 @@ getLabel();'), - $this->pages)); \ No newline at end of file + function($a) { return $a->getLabel(); }, + $this->pages)); From 41af1c27b57c7d152dcd524110aa38a1c0650d66 Mon Sep 17 00:00:00 2001 From: George Appleton Date: Tue, 24 Jul 2018 09:14:34 +0100 Subject: [PATCH 12/60] fixed occasion where counting null value --- library/Zend/Validate/File/FilesSize.php | 6 +----- library/Zend/Validate/File/ImageSize.php | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index b648133416..0c80079b78 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -155,10 +155,6 @@ public function isValid($value, $file = null) } } - if (count($this->_messages) > 0) { - return false; - } - - return true; + return !empty($this->_messages); } } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index 871fef84ff..b9e68dff5d 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -338,11 +338,7 @@ public function isValid($value, $file = null) $this->_throw($file, self::HEIGHT_TOO_BIG); } - if (count($this->_messages) > 0) { - return false; - } - - return true; + return !empty($this->_messages); } /** From a78c2401ba64381d28f0dd034169cb1961ae6b27 Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 2 Jan 2019 11:22:51 +0000 Subject: [PATCH 13/60] Update README.md --- README.md | 184 +----------------------------------------------------- 1 file changed, 1 insertion(+), 183 deletions(-) diff --git a/README.md b/README.md index 0d18637baf..46c5a12360 100644 --- a/README.md +++ b/README.md @@ -1,183 +1 @@ -![Logo](http://framework.zend.com/images/logos/ZendFramework-logo.png) - -> ## End-of-Life occurred 28 Sep 2016 -> -> This project is no longer maintained, and reached its end of life on 28 Sep -> 2016; the last public release was 1.12.20. -> -> At this time, the repository has been archived, and is read-only. - ---- - -Welcome to the Zend Framework 1.12 Release! - -Master: [![Build Status](https://api.travis-ci.org/zendframework/zf1.png?branch=master)](https://travis-ci.org/zendframework/zf1) - -RELEASE INFORMATION -=================== - -Zend Framework 1.12.21dev Release. -Released on MMM DD, YYYY. - -IMPORTANT FIXES FOR 1.12.21 ---------------------------- - -See http://framework.zend.com/changelog for full details. - -NEW FEATURES -============ - -Zend_Loader changes -------------------- - -A number of autoloaders and autoloader facilities were back ported from -ZF2 to provide performant alternatives to those already available in the -1.X releases. These include: Zend_Loader_StandardAutoloader, which -improves on Zend_Loader_Autoloader by allowing the ability to specify a -specific path to associate with a vendor prefix or namespace; -Zend_Loader_ClassMapAutoloader, which provides the ability to use lookup -tables for autoloading (which are typically the fastest possible way to -autoload); and Zend_Loader_AutoloaderFactory, which can both create and -update autoloaders for you, as well as register them with -spl_autoload_register(). - -The Zend_Loader changes were back ported from ZF2 by Matthew Weier -O’Phinney - -Zend_EventManager ------------------ - -Zend_EventManager is a component that allows you to attach and detach -listeners to named events, both on a per-instance basis as well as via -shared collections; trigger events; and interrupt execution of -listeners. - -Zend_EventManager was back ported from ZF2 by Matthew Weier O’Phinney - -Zend_Http_UserAgent_Features_Adapter_Browscap ---------------------------------------------- - -This class provides a features adapter that calls get_browser() in order -to discover mobile device capabilities to inject into UserAgent device -instances. - -Browscap (http://browsers.garykeith.com/) is an open project dedicated -to collecting an disseminating a “database” of browser capabilities. PHP -has built-in support for using these files via the get_browser() -function. This function requires that your php.ini provides a browscap -entry pointing to the PHP-specific php_browscap.ini file which is -available at http://browsers.garykeith.com/stream.asp?PHP_BrowsCapINI. - -Zend_Http_UserAgent_Features_Adapter_Browscap was created by Matthew -Weier O’Phinney - -Zend_Mobile_Push ----------------- - -Zend_Mobile_Push is a component for implementing push notifications for -the 3 major push notification platforms (Apple (Apns), Google (C2dm) and -Microsoft (Mpns). - -Zend_Mobile_Push was contributed by Mike Willbanks. - -Zend_Gdata_Analytics --------------------- - -Zend_Gdata_Analytics is an extension to Zend_Gdata to allow interaction -with Google’s Analytics Data Export API. This extension does not -encompass any major changes in the overall operation of Zend_Gdata -components. - -Zend_Gdata_Analytics was contributed by Daniel Hartmann. - -Removed features -================ - -Zend_Http_UserAgent_Features_Adapter_WurflApi ---------------------------------------------- - -Due to the changes in licensing of WURFL, we have removed the WurflApi -adapter. We will be providing the WurflApi adapter to ScientiaMobile so -that users of WURFL will still have that option. - -Bug Fixes -========= - -In addition, over 200 reported issues in the tracker have been fixed. -We’d like to particularly thank Adam Lundrigan, Frank Brückner and -Martin Hujer for their efforts in making this happen. Thanks also to the -many people who ran the ZF1 unit tests and reported their results! - -For a complete list of closed issues beginning with 1.12.3, visit: - - * https://github.com/zendframework/zf1/issues?labels=&milestone=&page=1&state=closed - * http://framework.zend.com/changelog/ - -MIGRATION NOTES -=============== - -A detailed list of migration notes may be found at: - -http://framework.zend.com/manual/en/migration.html - -SYSTEM REQUIREMENTS -=================== - -Zend Framework requires PHP 5.2.11 or later. Please see our reference -guide for more detailed system requirements: - -http://framework.zend.com/manual/en/requirements.html - -INSTALLATION -============ - -Please see [INSTALL.md](INSTALL.md). - -REPOSITORY HISTORY -================== - -This repository was created based on the release-1.12 branch of a Subversion -repository, http://framework.zend.com/svn/framework/standard/. It contains a -subset of the project history, dating from between the 1.5.0 and 1.6.0 releases, -and only contains the tags for the 1.12 series. If you would like an older -version, you may access the subversion repository linked above, or download an -older version from http://framework.zend.com/downloads/archives. - -CONTRIBUTING -============ - -Please see [README-GIT.md](README-GIT.md) and -[DEVELOPMENT_README.md](DEVELOPMENT_README.md). - -QUESTIONS AND FEEDBACK -====================== - -Online documentation can be found at http://framework.zend.com/manual. -Questions that are not addressed in the manual should be directed to the -appropriate mailing list: - -- http://framework.zend.com/wiki/display/ZFDEV/Mailing+Lists - -If you find code in this release behaving in an unexpected manner or -contrary to its documented behavior, please create an issue in the Zend -Framework issue tracker at: - -- https://github.com/zendframework/zf1/issues - -If you would like to be notified of new releases, you can subscribe to -the fw-announce mailing list by sending a blank message to: - -- fw-announce-subscribe@lists.zend.com. - -LICENSE -======= - -The files in this archive are released under the Zend Framework license. -You can find a copy of this license in [LICENSE.txt](LICENSE.txt). - -ACKNOWLEDGEMENTS -================ - -The Zend Framework team would like to thank all the contributors to the Zend -Framework project, our corporate sponsor, and you, the Zend Framework user. -Please visit us sometime soon at http://framework.zend.com. +Post end of life changes (made to master only so far) for zf1 to allow compatibility with PHP7.2 and potentially future versions From b5031517e04bf0515e5b0f1e8f487599a65a739c Mon Sep 17 00:00:00 2001 From: Jacek Karczmarczyk Date: Wed, 13 Feb 2019 12:40:54 +0700 Subject: [PATCH 14/60] fix(Form.php): PHP7.3 warning PHP 7.3: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? --- library/Zend/Form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Form.php b/library/Zend/Form.php index 0512dc850b..833ab98ab4 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -1170,7 +1170,7 @@ public function addElements(array $elements) } else { switch ($argc) { case 0: - continue; + break; case (1 <= $argc): $type = array_shift($spec); case (2 <= $argc): From ef8b3e0f46ced76f727bc48892b65c19a8c3173d Mon Sep 17 00:00:00 2001 From: Jacek Karczmarczyk Date: Wed, 13 Feb 2019 12:49:53 +0700 Subject: [PATCH 15/60] fix(Form.php): PHP 7.3. warning just another case of the same warning --- library/Zend/Form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Form.php b/library/Zend/Form.php index 833ab98ab4..f16b05f547 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -1687,7 +1687,7 @@ public function addSubForms(array $subForms) $order = null; switch ($argc) { case 0: - continue; + break; case (1 <= $argc): $subForm = array_shift($spec); From ddd624951274d80aa35320dee1d3893f6ce7b4a4 Mon Sep 17 00:00:00 2001 From: Marc Mittag Date: Tue, 26 Feb 2019 14:25:54 +0100 Subject: [PATCH 16/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46c5a12360..e3f2cf610b 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -Post end of life changes (made to master only so far) for zf1 to allow compatibility with PHP7.2 and potentially future versions +Post end of life changes (made to master only so far) for zf1 to allow compatibility with PHP7.3 and potentially future versions From a162cbfccacde89a63668ec16ab5aed8404ed300 Mon Sep 17 00:00:00 2001 From: Shardj Date: Tue, 26 Feb 2019 16:58:22 +0000 Subject: [PATCH 17/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46c5a12360..bb80f99d69 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -Post end of life changes (made to master only so far) for zf1 to allow compatibility with PHP7.2 and potentially future versions +Post end of life changes (made to master only so far) for zf1 to allow compatibility with PHP 7.2, 7.3, and potentially future versions From 70893e2cd8b9b3a25d7d372cae602b696c0fce36 Mon Sep 17 00:00:00 2001 From: Shardj Date: Tue, 26 Feb 2019 17:00:59 +0000 Subject: [PATCH 18/60] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 4bb24a34a0..0db3d5d28a 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "shardj/zendframework1-php7.2", - "description": "Zend Framework 1 PHP7.2 compatible", + "name": "shardj/zf1-future", + "description": "Zend Framework 1 PHP 7.2 and 7.3 compatible", "type": "library", "keywords": [ "framework", From e640b1be939ddd419398f092b6adf4d37372a7bd Mon Sep 17 00:00:00 2001 From: ines_paul Date: Thu, 28 Feb 2019 13:11:36 +0100 Subject: [PATCH 19/60] handling variables --- library/Zend/Rest/Route.php | 2 +- library/Zend/Validate/File/Upload.php | 10 ++++------ library/Zend/View/Helper/HeadLink.php | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/library/Zend/Rest/Route.php b/library/Zend/Rest/Route.php index 2b7cdd6241..949a43dd78 100644 --- a/library/Zend/Rest/Route.php +++ b/library/Zend/Rest/Route.php @@ -241,7 +241,7 @@ public function match($request, $partial = false) * @param bool $encode Weither to return urlencoded string * @return string Route path with user submitted parameters */ - public function assemble($data = array(), $reset = false, $encode = true) + public function assemble($data = array(), $reset = false, $encode = true, $partial = false) { if (!$this->_keysSet) { if (null === $this->_request) { diff --git a/library/Zend/Validate/File/Upload.php b/library/Zend/Validate/File/Upload.php index 5eae769846..ba5d309893 100644 --- a/library/Zend/Validate/File/Upload.php +++ b/library/Zend/Validate/File/Upload.php @@ -161,7 +161,9 @@ public function setFiles($files = array()) */ public function isValid($value, $file = null) { - $this->_messages = null; + $this->_messages = array(); + $files = array(); + if (array_key_exists($value, $this->_files)) { $files[$value] = $this->_files[$value]; } else { @@ -223,11 +225,7 @@ public function isValid($value, $file = null) } } - if (count($this->_messages) > 0) { - return false; - } else { - return true; - } + return empty($this->_messages); } /** diff --git a/library/Zend/View/Helper/HeadLink.php b/library/Zend/View/Helper/HeadLink.php index 61bf0a29d3..48cae230ff 100644 --- a/library/Zend/View/Helper/HeadLink.php +++ b/library/Zend/View/Helper/HeadLink.php @@ -396,6 +396,7 @@ public function createDataStylesheet(array $args) } } + $extras = null; if(0 < count($args) && is_array($args[0])) { $extras = array_shift($args); $extras = (array) $extras; From e4ab04988e8e5af9ddc65cdb85b428e0834579bb Mon Sep 17 00:00:00 2001 From: ines_paul Date: Thu, 28 Feb 2019 13:12:19 +0100 Subject: [PATCH 20/60] fix for error with session_set_cookie_params() --- library/Zend/Session.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index 6378cbf612..d1118db29b 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -366,16 +366,17 @@ public static function rememberUntil($seconds = 0) self::regenerateId(); return; } - - $cookieParams = session_get_cookie_params(); - - session_set_cookie_params( - $seconds, - $cookieParams['path'], - $cookieParams['domain'], - $cookieParams['secure'] - ); - + + if (!self::sessionExists()) { // session_set_cookie_params(): Cannot change session cookie parameters when session is active + $cookieParams = session_get_cookie_params(); + session_set_cookie_params( + $seconds, + $cookieParams['path'], + $cookieParams['domain'], + $cookieParams['secure'] + ); + } + // normally "rememberMe()" represents a security context change, so should use new session id self::regenerateId(); } @@ -532,6 +533,7 @@ protected static function _checkId($id) if (!$hashBitsPerChar) { $hashBitsPerChar = 5; // the default value } + $pattern = ''; switch($hashBitsPerChar) { case 4: $pattern = '^[0-9a-f]*$'; break; case 5: $pattern = '^[0-9a-v]*$'; break; From c5106b85010515c10b806e03be0a98d676550de4 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 11 Mar 2019 11:46:00 +0000 Subject: [PATCH 21/60] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb80f99d69..734118a7c6 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -Post end of life changes (made to master only so far) for zf1 to allow compatibility with PHP 7.2, 7.3, and potentially future versions +Post end of life changes for zf1 to allow compatibility with PHP 7.2, 7.3, and potentially future versions + +If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. From 82a4367dd3e939778d65bb0886fb9928c0858609 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 11 Mar 2019 14:13:57 +0000 Subject: [PATCH 22/60] fixed session warning --- library/Zend/Session.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index d1118db29b..da4f8830a3 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -216,7 +216,9 @@ public static function setOptions(array $userOptions = array()) // set the ini based values if (array_key_exists($userOptionName, self::$_defaultOptions)) { - ini_set("session.$userOptionName", $userOptionValue); + if(!self::$_sessionStarted) { + ini_set("session.$userOptionName", $userOptionValue); + } } elseif (isset(self::$_localOptions[$userOptionName])) { self::${self::$_localOptions[$userOptionName]} = $userOptionValue; From a4437324e6d705b46017489d241a9d9ae9ef4192 Mon Sep 17 00:00:00 2001 From: Deniz Zoeteman Date: Fri, 12 Apr 2019 11:51:47 +0200 Subject: [PATCH 23/60] Add replace in composer.json for zf1 dependencies ZF1 dependencies (i.e. zf1 doctrine) require the original zf1 package. This PR adds `replace` to composer.json to make sure regular zf1 is not included in the vendor. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 0db3d5d28a..15a5198258 100644 --- a/composer.json +++ b/composer.json @@ -33,5 +33,8 @@ }, "archive": { "exclude": ["/demos", "/documentation", "/tests"] + }, + "replace": { + "zendframework/zendframework1": "1.*" } } From e42e06f0843be4103a9a8443bb893c6bb5b4abe4 Mon Sep 17 00:00:00 2001 From: Warhole9 Date: Thu, 18 Apr 2019 14:53:55 +0200 Subject: [PATCH 24/60] update File Reflection: replace continue by break in switch context --- library/Zend/Reflection/File.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Zend/Reflection/File.php b/library/Zend/Reflection/File.php index 86d9ffa35a..3e1b21c57d 100644 --- a/library/Zend/Reflection/File.php +++ b/library/Zend/Reflection/File.php @@ -355,7 +355,7 @@ protected function _reflect() case T_DOLLAR_OPEN_CURLY_BRACES: case T_CURLY_OPEN: $embeddedVariableTrapped = true; - continue; + break; // Name of something case T_STRING: @@ -366,7 +366,7 @@ protected function _reflect() $this->_classes[] = $value; $classTrapped = false; } - continue; + break; // Required file names are T_CONSTANT_ENCAPSED_STRING case T_CONSTANT_ENCAPSED_STRING: @@ -374,7 +374,7 @@ protected function _reflect() $this->_requiredFiles[] = $value ."\n"; $requireTrapped = false; } - continue; + break; // Functions case T_FUNCTION: From e84c47128937729030258025cf7335075c3e7a92 Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 17 May 2019 16:46:59 +0100 Subject: [PATCH 25/60] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1b04849b84..e8b2ca9e06 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potentially future versions If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. + +Installable through git clone or through composer `install zf1-future` https://packagist.org/packages/shardj/zf1-future From 2ad936d718824f0bcc4c8a46f486fbb759ff7d82 Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 17 May 2019 16:47:20 +0100 Subject: [PATCH 26/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8b2ca9e06..e3f8654c08 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potent If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. -Installable through git clone or through composer `install zf1-future` https://packagist.org/packages/shardj/zf1-future +Installable through git clone or through `composer install zf1-future` https://packagist.org/packages/shardj/zf1-future From 4c7092339c249d83994212535d3a1427b736be64 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 15 Jul 2019 14:49:34 +0100 Subject: [PATCH 27/60] issue#8 - fixes php7.3 warning continue in switch statement --- library/Zend/Pdf/FileParser/Font/OpenType.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/Zend/Pdf/FileParser/Font/OpenType.php b/library/Zend/Pdf/FileParser/Font/OpenType.php index 05a1d96ba4..76e833cac8 100644 --- a/library/Zend/Pdf/FileParser/Font/OpenType.php +++ b/library/Zend/Pdf/FileParser/Font/OpenType.php @@ -890,7 +890,6 @@ protected function _parseCmapTable() $cmapOffset = $baseOffset + $offset; $this->moveToOffset($cmapOffset); $format = $this->readUInt(2); - $language = -1; switch ($format) { case 0x0: $cmapLength = $this->readUInt(2); @@ -898,7 +897,7 @@ protected function _parseCmapTable() if ($language != 0) { $this->_debugLog('Type 0 cmap tables must be language-independent;' . ' language: %d; skipping', $language); - continue; + continue 2; } break; @@ -917,7 +916,7 @@ protected function _parseCmapTable() case 0xa: // break intentionally omitted case 0xc: $this->_debugLog('Format: 0x%x currently unsupported; skipping', $format); - continue; + continue 2; //$this->skipBytes(2); //$cmapLength = $this->readUInt(4); //$language = $this->readUInt(4); @@ -929,7 +928,7 @@ protected function _parseCmapTable() default: $this->_debugLog('Unknown subtable format: 0x%x; skipping', $format); - continue; + continue 2; } $cmapType = $format; break; From 7b15f33d9fe20e13d59501f14a121a6e514837b6 Mon Sep 17 00:00:00 2001 From: Shardj Date: Thu, 1 Aug 2019 10:17:47 +0100 Subject: [PATCH 28/60] fixes countable error --- library/Zend/Validate/File/Count.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Validate/File/Count.php b/library/Zend/Validate/File/Count.php index aa822dfb14..6243927de7 100644 --- a/library/Zend/Validate/File/Count.php +++ b/library/Zend/Validate/File/Count.php @@ -254,7 +254,7 @@ public function isValid($value, $file = null) $this->addFile($value); } - $this->_count = count($this->_files); + $this->_count = count($this->_files ?? []); if (($this->_max !== null) && ($this->_count > $this->_max)) { return $this->_throw($file, self::TOO_MANY); } From 58a9fb04f16a15178256a8798e609793086da1a4 Mon Sep 17 00:00:00 2001 From: Andreas Malecki Date: Mon, 5 Aug 2019 15:21:53 +0200 Subject: [PATCH 29/60] Allow unit testing with PHP 7.2 --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index da4f8830a3..ce5836a84a 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -199,7 +199,7 @@ protected function __construct() public static function setOptions(array $userOptions = array()) { // set default options on first run only (before applying user settings) - if (!self::$_defaultOptionsSet) { + if (!self::$_defaultOptionsSet && !self::$_unitTestEnabled) { foreach (self::$_defaultOptions as $defaultOptionName => $defaultOptionValue) { if (isset(self::$_defaultOptions[$defaultOptionName])) { ini_set("session.$defaultOptionName", $defaultOptionValue); From 5c0857b7ba4a1348979ace46109f4f4693dc5e8a Mon Sep 17 00:00:00 2001 From: Dave Jennings Date: Tue, 6 Aug 2019 13:02:59 +0100 Subject: [PATCH 30/60] Count all keys with strictly non-null values Cater for values like empty strings and zeros when checking scalar types. --- library/Zend/Db/Table/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Table/Abstract.php b/library/Zend/Db/Table/Abstract.php index 2f2f60a3c8..cbd27db2fc 100644 --- a/library/Zend/Db/Table/Abstract.php +++ b/library/Zend/Db/Table/Abstract.php @@ -1307,7 +1307,7 @@ public function find() if (is_array($keyValues) || $keyValues instanceof Countable) { $keyValuesCount = count($keyValues); } else { - $keyValuesCount = $keyValues == null ? 0 : 1; + $keyValuesCount = $keyValues === null ? 0 : 1; } // Coerce the values to an array. // Don't simply typecast to array, because the values From b74aef304933837798ae8a69cb035504937e96ea Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 11 Sep 2019 15:56:52 +0100 Subject: [PATCH 31/60] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e3f8654c08..6d71e8fea3 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,5 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potent If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. Installable through git clone or through `composer install zf1-future` https://packagist.org/packages/shardj/zf1-future + +Recently https://github.com/Shardj/zf1-extras-future has been created for those who need it. From 2bceb8c792832a02b8d78bb837008fffe3d65a69 Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 11 Sep 2019 16:00:07 +0100 Subject: [PATCH 32/60] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d71e8fea3..7ac66ec942 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potent If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. -Installable through git clone or through `composer install zf1-future` https://packagist.org/packages/shardj/zf1-future +Installable through git clone or through `composer require shardj/zf1-future` https://packagist.org/packages/shardj/zf1-future Recently https://github.com/Shardj/zf1-extras-future has been created for those who need it. From e9f3dd85a7b89aa287a6cbff52301ce182d5689c Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sat, 21 Sep 2019 10:21:21 +0100 Subject: [PATCH 33/60] Update Date::setOptions() -> fix phpdoc @return Options is invalid (no such class etc). Method either returns an array or void. --- library/Zend/Date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Date.php b/library/Zend/Date.php index 48bc906f9b..756107b225 100644 --- a/library/Zend/Date.php +++ b/library/Zend/Date.php @@ -233,7 +233,7 @@ public function __construct($date = null, $part = null, $locale = null) * * @param array $options Options to set * @throws Zend_Date_Exception - * @return Options array if no option was given + * @return array|void if no option was given */ public static function setOptions(array $options = array()) { From 66cbd6f5cded45e9feceda53f9fe63625baeee60 Mon Sep 17 00:00:00 2001 From: Dalm Date: Mon, 23 Sep 2019 09:13:07 +0200 Subject: [PATCH 34/60] Fix count() Warnings during bin/zf create issue #15 --- library/Zend/Tool/Project/Profile/Resource/Container.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Tool/Project/Profile/Resource/Container.php b/library/Zend/Tool/Project/Profile/Resource/Container.php index 4f06f6f55d..ffbee3ebc0 100644 --- a/library/Zend/Tool/Project/Profile/Resource/Container.php +++ b/library/Zend/Tool/Project/Profile/Resource/Container.php @@ -383,7 +383,7 @@ public function valid() */ public function hasChildren() { - return (count($this->_subResources > 0)) ? true : false; + return (count($this->_subResources) > 0) ? true : false; } /** From 75dc2887b17f21ac806da6c8f0a3d8fd9b995366 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 23 Sep 2019 12:27:59 +0100 Subject: [PATCH 35/60] Fixes typo causing yaml.php to break --- library/Zend/Config/Yaml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 9811fda862..565036712a 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -289,7 +289,7 @@ protected static function _decodeYaml($currentIndent, &$lines) { $config = array(); $inIndent = false; - foreach ($line as $n => $line) { + foreach ($lines as $n => $line) { $lineno = $n + 1; $line = rtrim(preg_replace("/#.*$/", "", $line)); From b74c432fbbddfbf61bb6f84b49840126180be0df Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 4 Oct 2019 16:50:11 +0100 Subject: [PATCH 36/60] Fixes yaml.php --- library/Zend/Config/Yaml.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 565036712a..3d0dbe3395 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -274,7 +274,6 @@ protected function _processExtends(array $data, $section, array $config = array( public static function decode($yaml) { $lines = explode("\n", $yaml); - reset($lines); return self::_decodeYaml(0, $lines); } @@ -285,29 +284,29 @@ public static function decode($yaml) * @param array $lines YAML lines * @return array|string */ - protected static function _decodeYaml($currentIndent, &$lines) + protected static function _decodeYaml($currentIndent, &$lines, &$pointer = -1) { - $config = array(); + $config = array(); $inIndent = false; - foreach ($lines as $n => $line) { - $lineno = $n + 1; + while (++$pointer < count($lines)) { + $lineno = $pointer + 1; - $line = rtrim(preg_replace("/#.*$/", "", $line)); - if (strlen($line) == 0) { + $lines[$pointer] = rtrim(preg_replace("/#.*$/", "", $lines[$pointer])); + if (strlen($lines[$pointer]) == 0) { continue; } - $indent = strspn($line, " "); + $indent = strspn($lines[$pointer], " "); // line without the spaces - $line = trim($line); - if (strlen($line) == 0) { + $lines[$pointer] = trim($lines[$pointer]); + if (strlen($lines[$pointer]) == 0) { continue; } if ($indent < $currentIndent) { // this level is done - prev($lines); + $pointer--; return $config; } @@ -316,7 +315,7 @@ protected static function _decodeYaml($currentIndent, &$lines) $inIndent = true; } - if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) { + if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $lines[$pointer], $m)) { // key: value if (strlen($m[2])) { // simple key: value @@ -324,27 +323,27 @@ protected static function _decodeYaml($currentIndent, &$lines) $value = self::_parseValue($value); } else { // key: and then values on new lines - $value = self::_decodeYaml($currentIndent + 1, $lines); + $value = self::_decodeYaml($currentIndent + 1, $lines, $pointer); if (is_array($value) && !count($value)) { $value = ""; } } $config[$m[1]] = $value; - } elseif ($line[0] == "-") { + } elseif ($lines[$pointer][0] == "-") { // item in the list: // - FOO - if (strlen($line) > 2) { - $value = substr($line, 2); + if (strlen($lines[$pointer]) > 2) { + $value = substr($lines[$pointer], 2); $config[] = self::_parseValue($value); } else { - $config[] = self::_decodeYaml($currentIndent + 1, $lines); + $config[] = self::_decodeYaml($currentIndent + 1, $lines, $pointer); } } else { require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception(sprintf( 'Error parsing YAML at line %d - unsupported syntax: "%s"', - $lineno, $line + $lineno, $lines[$pointer] )); } } From 25ab01b013a9d4960310c74a0c1df46ce574f5a3 Mon Sep 17 00:00:00 2001 From: Mark Gregan Date: Sat, 5 Oct 2019 00:19:42 +0200 Subject: [PATCH 37/60] Zend_Config_Yaml now handles multiple subkeys --- library/Zend/Config/Yaml.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 3d0dbe3395..be69d1c5f2 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -282,9 +282,10 @@ public static function decode($yaml) * * @param int $currentIndent Current indent level * @param array $lines YAML lines + * @param int $pointer The current line being parsed * @return array|string */ - protected static function _decodeYaml($currentIndent, &$lines, &$pointer = -1) + protected static function _decodeYaml($currentIndent, $lines, &$pointer = -1) { $config = array(); $inIndent = false; From ce4d3e611553291192adf29a0f70ba78e82750ee Mon Sep 17 00:00:00 2001 From: Dringho Date: Mon, 21 Oct 2019 09:11:43 -0300 Subject: [PATCH 38/60] Mute warning Zend_Session_SaveHandler_DbTable Mute warning when using Zend_Session_SaveHandler_DbTable. --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index ce5836a84a..ef46417268 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -733,7 +733,7 @@ public static function writeClose($readonly = true) parent::$_writable = false; } - session_write_close(); + @session_write_close(); self::$_writeClosed = true; } From 17416b28d6e997afaf0ce8fb4e3a2a29ca329329 Mon Sep 17 00:00:00 2001 From: Dringho Date: Mon, 21 Oct 2019 13:26:12 -0300 Subject: [PATCH 39/60] Revert Revert --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index ef46417268..ce5836a84a 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -733,7 +733,7 @@ public static function writeClose($readonly = true) parent::$_writable = false; } - @session_write_close(); + session_write_close(); self::$_writeClosed = true; } From 9175301058d324bcdcdca0d091b2e6c394273a95 Mon Sep 17 00:00:00 2001 From: Dringho Date: Mon, 21 Oct 2019 13:31:35 -0300 Subject: [PATCH 40/60] Fix when the date is the same as stored update returns 0 if the data being updated matches the one in the database, which produces a `false` return, which in turn triggers a warning in Zend_Session::writeClose - session_write_close() --- library/Zend/Session/SaveHandler/DbTable.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/Zend/Session/SaveHandler/DbTable.php b/library/Zend/Session/SaveHandler/DbTable.php index e423a18d4c..69c2cf2326 100644 --- a/library/Zend/Session/SaveHandler/DbTable.php +++ b/library/Zend/Session/SaveHandler/DbTable.php @@ -346,10 +346,8 @@ public function write($id, $data) if (count($rows)) { $data[$this->_lifetimeColumn] = $this->_getLifetime($rows->current()); - - if ($this->update($data, $this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { - $return = true; - } + $this->update($data, $this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE)); + $return = true; } else { $data[$this->_lifetimeColumn] = $this->_lifetime; From 29c2e4bccbf8f532431e5e0c30cd2384586a390d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20W=C3=B3jcicki?= Date: Thu, 7 Nov 2019 10:21:16 +0100 Subject: [PATCH 41/60] Fixed return value for isValid() method in Zend_Validate_File_FilesSize and Zend_Validate_File_ImageSize. --- library/Zend/Validate/File/FilesSize.php | 2 +- library/Zend/Validate/File/ImageSize.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index 0c80079b78..6fdb57cae7 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -155,6 +155,6 @@ public function isValid($value, $file = null) } } - return !empty($this->_messages); + return empty($this->_messages); } } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index b9e68dff5d..1f1796109f 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -338,7 +338,7 @@ public function isValid($value, $file = null) $this->_throw($file, self::HEIGHT_TOO_BIG); } - return !empty($this->_messages); + return empty($this->_messages); } /** From 6a5534f319c9030f0d58271516d04068f44ab8f1 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 11 Nov 2019 09:12:15 +0000 Subject: [PATCH 42/60] Fixes relative url check failing for uppercase url schemas --- library/Zend/Controller/Action/Helper/Redirector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index 8c81646224..5bd727c634 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -363,7 +363,7 @@ public function setGotoUrl($url, array $options = array()) } // If relative URL, decide if we should prepend base URL - if (!preg_match('|^[a-z]+://|', $url)) { + if (!preg_match('|^[a-z]+://|i', $url)) { $url = $this->_prependBase($url); } From a518b235a24a9ed64607632dbf8a246c9c52b06e Mon Sep 17 00:00:00 2001 From: HellFirePvP <7419378+HellFirePvP@users.noreply.github.com> Date: Wed, 13 Nov 2019 18:02:16 +0100 Subject: [PATCH 43/60] Update Atom.php Break from switch-case to retry redirected URI regarding deletion. --- library/Zend/Feed/Entry/Atom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Feed/Entry/Atom.php b/library/Zend/Feed/Entry/Atom.php index 83fd8f1d06..3c3a0a8469 100644 --- a/library/Zend/Feed/Entry/Atom.php +++ b/library/Zend/Feed/Entry/Atom.php @@ -103,7 +103,7 @@ public function delete() // Redirect case 3: $deleteUri = $response->getHeader('Location'); - continue; + break; // Error default: /** From abb38276407046478ee24f7aeb5bc62fd781da16 Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 15 Nov 2019 10:11:37 +0000 Subject: [PATCH 44/60] Delete PULL_REQUEST_TEMPLATE --- PULL_REQUEST_TEMPLATE | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 PULL_REQUEST_TEMPLATE diff --git a/PULL_REQUEST_TEMPLATE b/PULL_REQUEST_TEMPLATE deleted file mode 100644 index f0289361e5..0000000000 --- a/PULL_REQUEST_TEMPLATE +++ /dev/null @@ -1,4 +0,0 @@ -Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. -No Pull Requests will be accepted. - -https://framework.zend.com/blog/2016-06-28-zf1-eol.html From d2220779d7ea7e90cc96c7985d2366a758cbee1d Mon Sep 17 00:00:00 2001 From: "francesco.loreti" Date: Wed, 27 Nov 2019 14:03:42 +0100 Subject: [PATCH 45/60] Replace d.adsrc that it's removed into postgresql 12 #28 --- library/Zend/Db/Adapter/Pdo/Pgsql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Adapter/Pdo/Pgsql.php b/library/Zend/Db/Adapter/Pdo/Pgsql.php index abd5e637b0..efb74cd145 100644 --- a/library/Zend/Db/Adapter/Pdo/Pgsql.php +++ b/library/Zend/Db/Adapter/Pdo/Pgsql.php @@ -156,7 +156,7 @@ public function describeTable($tableName, $schemaName = null) t.typname AS type, a.atttypmod, FORMAT_TYPE(a.atttypid, a.atttypmod) AS complete_type, - d.adsrc AS default_value, + pg_get_expr(d.adbin, d.adrelid) AS default_value, a.attnotnull AS notnull, a.attlen AS length, co.contype, From 9f49d09a10434ffec3bb217f5c8a5f1647d13647 Mon Sep 17 00:00:00 2001 From: Bloafer Date: Mon, 2 Dec 2019 11:23:52 +0000 Subject: [PATCH 46/60] Bump version to 1.15.2 --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index ea3df6f7f0..099a1176b9 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.12.21dev'; + const VERSION = '1.15.2'; /** * The latest stable version Zend Framework available From c488fa1f9df9e6ce190199fdce4163be8337e17a Mon Sep 17 00:00:00 2001 From: Stephan Eicher Date: Tue, 3 Dec 2019 19:37:32 +0100 Subject: [PATCH 47/60] Fix php 7.4 deprecation curly brakets access on strings --- library/Zend/Barcode/Object/Upce.php | 8 ++++---- library/Zend/Filter/Compress/Zip.php | 2 +- library/Zend/Json/Decoder.php | 2 +- library/Zend/Json/Encoder.php | 14 +++++++------- .../Project/Context/Zf/ApplicationConfigFile.php | 2 +- library/Zend/View/Helper/Navigation/Sitemap.php | 4 ++-- library/Zend/Wildfire/Plugin/FirePhp.php | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/library/Zend/Barcode/Object/Upce.php b/library/Zend/Barcode/Object/Upce.php index cbb5b9bd3e..8302b698f1 100644 --- a/library/Zend/Barcode/Object/Upce.php +++ b/library/Zend/Barcode/Object/Upce.php @@ -84,8 +84,8 @@ protected function _getDefaultOptions() public function getText() { $text = parent::getText(); - if ($text{0} != 1) { - $text{0} = 0; + if ($text[0] != 1) { + $text[0] = 0; } return $text; } @@ -222,8 +222,8 @@ protected function _validateText($value, $options = array()) public function getChecksum($text) { $text = $this->_addLeadingZeros($text, true); - if ($text{0} != 1) { - $text{0} = 0; + if ($text[0] != 1) { + $text[0] = 0; } return parent::getChecksum($text); } diff --git a/library/Zend/Filter/Compress/Zip.php b/library/Zend/Filter/Compress/Zip.php index 9921fe9648..9c71a88444 100644 --- a/library/Zend/Filter/Compress/Zip.php +++ b/library/Zend/Filter/Compress/Zip.php @@ -237,7 +237,7 @@ public function decompress($content) for ($i = 0; $i < $zip->numFiles; $i++) { $statIndex = $zip->statIndex($i); $currName = $statIndex['name']; - if (($currName{0} == '/') || + if (($currName[0] == '/') || (substr($currName, 0, 2) == '..') || (substr($currName, 0, 4) == './..') ) diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index 8a79f0cdd2..cc83115199 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -552,7 +552,7 @@ protected static function _utf162utf8($utf16) return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); } - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); switch (true) { case ((0x7F & $bytes) == $bytes): diff --git a/library/Zend/Json/Encoder.php b/library/Zend/Json/Encoder.php index fbf5b53cca..9013b285c3 100644 --- a/library/Zend/Json/Encoder.php +++ b/library/Zend/Json/Encoder.php @@ -558,17 +558,17 @@ protected static function _utf82utf16($utf8) case 2: // return a UTF-16 character from a 2-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); + return chr(0x07 & (ord($utf8[0]) >> 2)) + . chr((0xC0 & (ord($utf8[0]) << 6)) + | (0x3F & ord($utf8[1]))); case 3: // return a UTF-16 character from a 3-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); + return chr((0xF0 & (ord($utf8[0]) << 4)) + | (0x0F & (ord($utf8[1]) >> 2))) + . chr((0xC0 & (ord($utf8[1]) << 6)) + | (0x7F & ord($utf8[2]))); } // ignoring UTF-32 for now, sorry diff --git a/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php b/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php index da74e4dbec..0f4c5a5c2f 100644 --- a/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php +++ b/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php @@ -139,7 +139,7 @@ public function addStringItem($key, $value, $section = 'production', $quoteValue $newLines[] = $contentLine; if ($insideSection) { // if its blank, or a section heading - if (isset($contentLines[$contentLineIndex + 1]{0}) && $contentLines[$contentLineIndex + 1]{0} == '[') { + if (isset($contentLines[$contentLineIndex + 1][0]) && $contentLines[$contentLineIndex + 1][0] == '[') { $newLines[] = $key . ' = ' . $value; $insideSection = null; } else if (!isset($contentLines[$contentLineIndex + 1])){ diff --git a/library/Zend/View/Helper/Navigation/Sitemap.php b/library/Zend/View/Helper/Navigation/Sitemap.php index b93808a2c6..4df6dc38d1 100644 --- a/library/Zend/View/Helper/Navigation/Sitemap.php +++ b/library/Zend/View/Helper/Navigation/Sitemap.php @@ -253,10 +253,10 @@ public function url(Zend_Navigation_Page $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/library/Zend/Wildfire/Plugin/FirePhp.php b/library/Zend/Wildfire/Plugin/FirePhp.php index b0e3d5e87a..727d7daaaf 100644 --- a/library/Zend/Wildfire/Plugin/FirePhp.php +++ b/library/Zend/Wildfire/Plugin/FirePhp.php @@ -742,7 +742,7 @@ protected function _encodeObject($object, $objectDepth = 1, $arrayDepth = 1) $name = $raw_name = $just_name; - if ($name{0} == "\0") { + if ($name[0] == "\0") { $parts = explode("\0", $name); $name = $parts[2]; } From f5fd9dd4bca5de6c283ba2c4359a3574ba226a92 Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 4 Dec 2019 12:11:47 +0000 Subject: [PATCH 48/60] Restores php 5 compatibility to count.php --- library/Zend/Validate/File/Count.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Validate/File/Count.php b/library/Zend/Validate/File/Count.php index 6243927de7..95876f337b 100644 --- a/library/Zend/Validate/File/Count.php +++ b/library/Zend/Validate/File/Count.php @@ -254,7 +254,7 @@ public function isValid($value, $file = null) $this->addFile($value); } - $this->_count = count($this->_files ?? []); + $this->_count = count($this->_files === null ? [] : $this->_files); if (($this->_max !== null) && ($this->_count > $this->_max)) { return $this->_throw($file, self::TOO_MANY); } From fe715327ed6ed1ce0d6ec120317524225c9e02bd Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 4 Dec 2019 12:15:25 +0000 Subject: [PATCH 49/60] Bumping version for new release of first php 7.4 compatibility patches --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 099a1176b9..116e93ef9a 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.15.2'; + const VERSION = '1.16.0'; /** * The latest stable version Zend Framework available From da7cc642955f913836df5c6c24b619522c5ffc9a Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 4 Dec 2019 12:19:51 +0000 Subject: [PATCH 50/60] Changes descriptions to be less specific about the currently supported php versions as we move to support php 7.4 --- README.md | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ac66ec942..f2dedb62cf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potentially future versions +Post end of life changes for zf1 to allow compatibility with the latest PHP versions. If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. diff --git a/composer.json b/composer.json index 15a5198258..1e5ad7d335 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "shardj/zf1-future", - "description": "Zend Framework 1 PHP 7.2 and 7.3 compatible", + "description": "Zend Framework 1 PHP 5.2.11+ compatible. The aim is to keep ZF1 working with the latest PHP versions", "type": "library", "keywords": [ "framework", From 59fa1a8fc952443b30ab2a5b1be4ea1c8506d7c2 Mon Sep 17 00:00:00 2001 From: aforster Date: Fri, 6 Dec 2019 10:54:10 +0100 Subject: [PATCH 51/60] Remove offsetExists from Zend_Registry to silence array_key_exists on object deprecation warning The method offsetExists was a workaround for a SPL bug which was fixed in April 2007, see http://bugs.php.net/bug.php?id=40442 --- library/Zend/Registry.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/library/Zend/Registry.php b/library/Zend/Registry.php index 837b05ae50..4a15a4d18f 100644 --- a/library/Zend/Registry.php +++ b/library/Zend/Registry.php @@ -195,15 +195,4 @@ public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS) parent::__construct($array, $flags); } - /** - * @param string $index - * @returns mixed - * - * Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960). - */ - public function offsetExists($index) - { - return array_key_exists($index, $this); - } - } From 1403a5dd81637ad18e0a70df439bb843486dc6ac Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 6 Dec 2019 15:06:07 +0000 Subject: [PATCH 52/60] Updated the minimum version to 5.4 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1e5ad7d335..3d09685608 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "shardj/zf1-future", - "description": "Zend Framework 1 PHP 5.2.11+ compatible. The aim is to keep ZF1 working with the latest PHP versions", + "description": "Zend Framework 1 PHP 5.4+ compatible. The aim is to keep ZF1 working with the latest PHP versions", "type": "library", "keywords": [ "framework", @@ -9,7 +9,7 @@ "homepage": "http://framework.zend.com/", "license": "BSD-3-Clause", "require": { - "php": ">=5.2.11" + "php": ">=5.4" }, "autoload": { "psr-0": { From 3c230c8f7d152cd6c240030f4c339bad67ed605b Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 16 Dec 2019 16:00:58 +0000 Subject: [PATCH 53/60] Delete ISSUE_TEMPLATE --- ISSUE_TEMPLATE | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 ISSUE_TEMPLATE diff --git a/ISSUE_TEMPLATE b/ISSUE_TEMPLATE deleted file mode 100644 index f0289361e5..0000000000 --- a/ISSUE_TEMPLATE +++ /dev/null @@ -1,4 +0,0 @@ -Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. -No Pull Requests will be accepted. - -https://framework.zend.com/blog/2016-06-28-zf1-eol.html From efca2e2c637373e64b4c67c0acd1a620bb6b4c27 Mon Sep 17 00:00:00 2001 From: Guilherme Padilha Date: Mon, 16 Dec 2019 17:34:53 -0300 Subject: [PATCH 54/60] feat: pdo_sqlsrv by Akrabat --- library/Zend/Db/Adapter/Pdo/Sqlsrv.php | 382 +++++++++++++++ library/Zend/Db/Schema/AbstractChange.php | 41 ++ library/Zend/Db/Schema/Exception.php | 3 + library/Zend/Db/Schema/Manager.php | 384 +++++++++++++++ library/Zend/Tool/DatabaseSchemaProvider.php | 471 +++++++++++++++++++ 5 files changed, 1281 insertions(+) create mode 100644 library/Zend/Db/Adapter/Pdo/Sqlsrv.php create mode 100644 library/Zend/Db/Schema/AbstractChange.php create mode 100644 library/Zend/Db/Schema/Exception.php create mode 100644 library/Zend/Db/Schema/Manager.php create mode 100644 library/Zend/Tool/DatabaseSchemaProvider.php diff --git a/library/Zend/Db/Adapter/Pdo/Sqlsrv.php b/library/Zend/Db/Adapter/Pdo/Sqlsrv.php new file mode 100644 index 0000000000..ec507256f5 --- /dev/null +++ b/library/Zend/Db/Adapter/Pdo/Sqlsrv.php @@ -0,0 +1,382 @@ + Zend_Db::INT_TYPE, + Zend_Db::BIGINT_TYPE => Zend_Db::BIGINT_TYPE, + Zend_Db::FLOAT_TYPE => Zend_Db::FLOAT_TYPE, + 'INT' => Zend_Db::INT_TYPE, + 'SMALLINT' => Zend_Db::INT_TYPE, + 'TINYINT' => Zend_Db::INT_TYPE, + 'BIGINT' => Zend_Db::BIGINT_TYPE, + 'DECIMAL' => Zend_Db::FLOAT_TYPE, + 'FLOAT' => Zend_Db::FLOAT_TYPE, + 'MONEY' => Zend_Db::FLOAT_TYPE, + 'NUMERIC' => Zend_Db::FLOAT_TYPE, + 'REAL' => Zend_Db::FLOAT_TYPE, + 'SMALLMONEY' => Zend_Db::FLOAT_TYPE + ); + + /** + * Creates a PDO DSN for the adapter from $this->_config settings. + * + * @return string + */ + protected function _dsn() + { + // baseline of DSN parts + $dsn = $this->_config; + + if (isset($dsn['name'])) { + $dsn = $this->_pdoType . ':' . $dsn['name']; + } else { + + if(isset($dsn['dbname'])) { + $dsn['Database'] = $dsn['dbname']; + unset($dsn['dbname']); + } + + if(isset($dsn['host'])) { + if($dsn['host'] == '127.0.0.1') { + $dsn['host'] = '(local)'; + } + $dsn['Server'] = $dsn['host']; + unset($dsn['host']); + } + + unset($dsn['username']); + unset($dsn['password']); + unset($dsn['options']); + unset($dsn['charset']); + unset($dsn['persistent']); + unset($dsn['driver_options']); + if (isset($dsn['ReturnDatesAsStrings'])) { + // common sqlsrv setting but not supported by pdo_sqlsrv + unset($dsn['ReturnDatesAsStrings']); + } + + + foreach ($dsn as $key => $val) { + $dsn[$key] = "$key=$val"; + } + + $dsn = $this->_pdoType . ':' . implode(';', $dsn); + } + + return $dsn; + } + + /** + * @return void + */ + protected function _connect() + { + if ($this->_connection) { + return; + } + parent::_connect(); + $this->_connection->exec('SET QUOTED_IDENTIFIER ON'); + } + + /** + * Set the transaction isoltion level. + * + * @param integer|null $level A fetch mode from SQLSRV_TXN_*. + * @return true + * @throws Zend_Db_Adapter_Sqlsrv_Exception + */ + public function setTransactionIsolationLevel($level = null) + { + $this->_connect(); + $sql = null; + + // Default transaction level in sql server + if ($level === null) + { + $level = SQLSRV_TXN_READ_COMMITTED; + } + + switch ($level) { + case SQLSRV_TXN_READ_UNCOMMITTED: + $sql = "READ UNCOMMITTED"; + break; + case SQLSRV_TXN_READ_COMMITTED: + $sql = "READ COMMITTED"; + break; + case SQLSRV_TXN_REPEATABLE_READ: + $sql = "REPEATABLE READ"; + break; + case SQLSRV_TXN_SNAPSHOT: + $sql = "SNAPSHOT"; + break; + case SQLSRV_TXN_SERIALIZABLE: + $sql = "SERIALIZABLE"; + break; + default: + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("Invalid transaction isolation level mode '$level' specified"); + } + + if (!$this->_connection->exec("SET TRANSACTION ISOLATION LEVEL $sql;")) { + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("Transaction cannot be changed to '$level'"); + } + + return true; + } + + + /** + * Returns a list of the tables in the database. + * + * @return array + */ + public function listTables() + { + $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; + return $this->fetchCol($sql); + } + + /** + * Returns the column descriptions for a table. + * + * The return value is an associative array keyed by the column name, + * as returned by the RDBMS. + * + * The value of each array element is an associative array + * with the following keys: + * + * SCHEMA_NAME => string; name of database or schema + * TABLE_NAME => string; + * COLUMN_NAME => string; column name + * COLUMN_POSITION => number; ordinal position of column in table + * DATA_TYPE => string; SQL datatype name of column + * DEFAULT => string; default expression of column, null if none + * NULLABLE => boolean; true if column can have nulls + * LENGTH => number; length of CHAR/VARCHAR + * SCALE => number; scale of NUMERIC/DECIMAL + * PRECISION => number; precision of NUMERIC/DECIMAL + * UNSIGNED => boolean; unsigned property of an integer type + * PRIMARY => boolean; true if column is part of the primary key + * PRIMARY_POSITION => integer; position of column in primary key + * PRIMARY_AUTO => integer; position of auto-generated column in primary key + * + * @todo Discover column primary key position. + * @todo Discover integer unsigned property. + * + * @param string $tableName + * @param string $schemaName OPTIONAL + * @return array + */ + public function describeTable($tableName, $schemaName = null) + { + if ($schemaName != null) { + if (strpos($schemaName, '.') !== false) { + $result = explode('.', $schemaName); + $schemaName = $result[1]; + } + } + /** + * Discover metadata information about this table. + */ + $sql = "exec sp_columns @table_name = " . $this->quoteIdentifier($tableName, true); + if ($schemaName != null) { + $sql .= ", @table_owner = " . $this->quoteIdentifier($schemaName, true); + } + + $stmt = $this->query($sql); + $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); + + $table_name = 2; + $column_name = 3; + $type_name = 5; + $precision = 6; + $length = 7; + $scale = 8; + $nullable = 10; + $column_def = 12; + $column_position = 16; + + /** + * Discover primary key column(s) for this table. + */ + $sql = "exec sp_pkeys @table_name = " . $this->quoteIdentifier($tableName, true); + if ($schemaName != null) { + $sql .= ", @table_owner = " . $this->quoteIdentifier($schemaName, true); + } + + $stmt = $this->query($sql); + $primaryKeysResult = $stmt->fetchAll(Zend_Db::FETCH_NUM); + $primaryKeyColumn = array(); + $pkey_column_name = 3; + $pkey_key_seq = 4; + foreach ($primaryKeysResult as $pkeysRow) { + $primaryKeyColumn[$pkeysRow[$pkey_column_name]] = $pkeysRow[$pkey_key_seq]; + } + + $desc = array(); + $p = 1; + foreach ($result as $key => $row) { + $identity = false; + $words = explode(' ', $row[$type_name], 2); + if (isset($words[0])) { + $type = $words[0]; + if (isset($words[1])) { + $identity = (bool) preg_match('/identity/', $words[1]); + } + } + + $isPrimary = array_key_exists($row[$column_name], $primaryKeyColumn); + if ($isPrimary) { + $primaryPosition = $primaryKeyColumn[$row[$column_name]]; + } else { + $primaryPosition = null; + } + + $desc[$this->foldCase($row[$column_name])] = array( + 'SCHEMA_NAME' => null, // @todo + 'TABLE_NAME' => $this->foldCase($row[$table_name]), + 'COLUMN_NAME' => $this->foldCase($row[$column_name]), + 'COLUMN_POSITION' => (int) $row[$column_position], + 'DATA_TYPE' => $type, + 'DEFAULT' => $row[$column_def], + 'NULLABLE' => (bool) $row[$nullable], + 'LENGTH' => $row[$length], + 'SCALE' => $row[$scale], + 'PRECISION' => $row[$precision], + 'UNSIGNED' => null, // @todo + 'PRIMARY' => $isPrimary, + 'PRIMARY_POSITION' => $primaryPosition, + 'IDENTITY' => $identity + ); + } + return $desc; + } + + /** + * Adds an adapter-specific LIMIT clause to the SELECT statement. + * + * @param string $sql + * @param integer $count + * @param integer $offset OPTIONAL + * @return string + * @throws Zend_Db_Adapter_Exceptions + */ + public function limit($sql, $count, $offset = 0) + { + $count = intval($count); + if ($count <= 0) { + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); + } + + $offset = intval($offset); + if ($offset < 0) { + /** @see Zend_Db_Adapter_Exception */ + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); + } + + if ($offset == 0) { + $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $count . ' ', $sql); + } else { + $orderby = stristr($sql, 'ORDER BY'); + if ($orderby !== false) { + $sort = (stripos($orderby, ' desc') !== false) ? 'desc' : 'asc'; + $order = str_ireplace('ORDER BY', '', $orderby); + $order = trim(preg_replace('/\bASC\b|\bDESC\b/i', '', $order)); + } + + $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . ($count+$offset) . ' ', $sql); + + $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl'; + if ($orderby !== false) { + $innerOrder = preg_replace('/\".*\".\"(.*)\"/i', '"inner_tbl"."$1"', $order); + $sql .= ' ORDER BY ' . $innerOrder . ' '; + $sql .= (stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC'; + } + $sql .= ') AS outer_tbl'; + if ($orderby !== false) { + $outerOrder = preg_replace('/\".*\".\"(.*)\"/i', '"outer_tbl"."$1"', $order); + $sql .= ' ORDER BY ' . $outerOrder . ' ' . $sort; + } + } + + return $sql; + } + + /** + * Retrieve server version in PHP style + * Pdo_Mssql doesn't support getAttribute(PDO::ATTR_SERVER_VERSION) + * @return string + */ + public function getServerVersion() + { + try { + $stmt = $this->query("SELECT SERVERPROPERTY('productversion')"); + $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); + if (count($result)) { + return $result[0][0]; + } + return null; + } catch (PDOException $e) { + return null; + } + } +} \ No newline at end of file diff --git a/library/Zend/Db/Schema/AbstractChange.php b/library/Zend/Db/Schema/AbstractChange.php new file mode 100644 index 0000000000..16590ea095 --- /dev/null +++ b/library/Zend/Db/Schema/AbstractChange.php @@ -0,0 +1,41 @@ +_db = $db; + $this->_tablePrefix = $tablePrefix; + } + + /** + * Changes to be applied in this change + * + * @return null + */ + abstract function up(); + + /** + * Rollback changes made in up() + * + * @return null + */ + abstract function down(); + +} \ No newline at end of file diff --git a/library/Zend/Db/Schema/Exception.php b/library/Zend/Db/Schema/Exception.php new file mode 100644 index 0000000000..38e996cc90 --- /dev/null +++ b/library/Zend/Db/Schema/Exception.php @@ -0,0 +1,3 @@ + prefix string to place before table names + * 'schema_version_table_name' => name of table to use for holding the schema version number + * + * + * @param string $dir Directory where migrations files are stored + * @param Zend_Db_Adapter_Abstract $db Database adapter + * @param string $tablePrefix Table prefix to be used by change files + */ + public function __construct($dir, Zend_Db_Adapter_Abstract $db, $tablePrefix='') + { + $this->_dir = realpath($dir); + $this->_db = $db; + $this->_tablePrefix = $tablePrefix; + } + + /** + * Retrieves the current database schema version from the database + * + * If the table does not exist, it will be created and the version will + * be set to 0. + * + * @return int + */ + public function getCurrentSchemaVersion() + { + // Ensure we have valid connection to the database + if (!$this->_db->isConnected()) { + $this->_db->getServerVersion(); + } + $schemaVersionTableName = $this->getPrefixedSchemaVersionTableName(); + + $sql = "SELECT version FROM " . $schemaVersionTableName; + try { + $version = $this->_db->fetchOne($sql); + } catch (Zend_Db_Exception $e) { + // exception means that the schema version table doesn't exist, so create it + $createSql = "CREATE TABLE $schemaVersionTableName ( + version bigint NOT NULL, + PRIMARY KEY (version) + )"; + $this->_db->query($createSql); + $insertSql = "INSERT INTO $schemaVersionTableName (version) VALUES (0)"; + $this->_db->query($insertSql); + $version = $this->_db->fetchOne($sql); + } + + return $version; + } + + /** + * Updates the database schema to a specified version. If upgrading (increasing + * version number) the schema version will be the largest available version + * that is less than or equal to the specified version. ie, if the highest version + * is 050 and 7000 is specified for $version, the resulting version will be + * 050. If downgrading (decreasing version number) the ending version will be + * the highest version that is less than or equal to the specified version + * number. i.e, if versions 10, 15 and 20 exist and the version is updated + * to 19, the resulting version will be 15 since version 20 will be downgraded. + * + * The method automatcally determines the direction of the migration by comparing + * the current version (from the database) and the desired version. If they + * are the same, no migration will be performed and the version will remain + * the same. + * + * @param string $version + * + * @return string + */ + public function updateTo($version = null) + { + if (is_null($version)) { + $version = PHP_INT_MAX; + } + $version = (int)$version; + $currentVersion = $this->getCurrentSchemaVersion(); + if($currentVersion == $version) { + return self::RESULT_AT_CURRENT_VERSION; + } + + $migrations = $this->_getMigrationFiles($currentVersion, $version); + if(empty($migrations)) { + if ($version == PHP_INT_MAX) { + return self::RESULT_AT_CURRENT_VERSION; + } + return self::RESULT_NO_MIGRATIONS_FOUND; + } + + $direction = 'up'; + if ($currentVersion > $version) { + $direction = 'down'; + } + foreach ($migrations as $migration) { + $this->_processFile($migration, $direction); + } + + // figure out what the real version we're going to is if going down + // TODO: make this more efficient by caching file information instead + // of fetching it again. + if ($direction == 'down') { + $files = $this->_getMigrationFiles($version, 0); + if (empty($files)) { + $realVersion = 0; + } else { + $versionFile = array_shift($files); + $realVersion = $versionFile['version']; + } + // update the database to the version we're actually at + $this->_updateSchemaVersion($realVersion); + } + + return self::RESULT_OK; + } + + /** + * Increments the database version a specified number of upgrades. For instance, + * if $versions is 1, it will update to the next highest version of the database. + * + * If $versions is provided and less than 1, it will assume 1 and update + * a single version. If a number higher than the available upgradable versions + * is specified, it will update to the highest version number. + * + * If the database is already at the highest version number available, it will + * not do anything and indicate it is at the maximum version number via + * the return value. + * + * @param int $versions Number of versions to increment. Must be 1 or greater + * + * @return string + */ + public function incrementVersion($versions) + { + $versions = (int)$versions; + if ($versions < 1) { + $versions = 1; + } + $currentVersion = $this->getCurrentSchemaVersion(); + + $files = $this->_getMigrationFiles($currentVersion, PHP_INT_MAX); + if (empty($files)) { + return self::RESULT_AT_MAXIMUM_VERSION; + } + + $files = array_slice($files, 0, $versions); + + $nextFile = array_pop($files); + $nextVersion = $nextFile['version']; + + return $this->updateTo($nextVersion); + } + + /** + * Decrements the version of the database by the specified number of versions. + * + * If the database is already at the lowest version number, it will indicate + * this through the return value. + * + * @param int $versions Number of versions to decrement. + * + * @return string + */ + public function decrementVersion($versions) + { + $versions = (int)$versions; + if ($versions < 1) { + $versions = 1; + } + $currentVersion = $this->getCurrentSchemaVersion(); + + $files = $this->_getMigrationFiles($currentVersion, 0); + if (empty($files)) { + return self::RESULT_AT_MINIMUM_VERSION; + } + + $files = array_slice($files, 0, $versions+1); + $nextFile = array_pop($files); + $nextVersion = $nextFile['version']; + + return $this->updateTo($nextVersion); + } + + /** + * Retrieves the migration files that are needed to take the database from + * its a specified version (current version) to the desired version. It + * will also determine the direction of the migration and sort the files + * accordingly. + * + * @param string $currentVersion Version to migrate database from + * @param string $stopVersion Version to migrate database to + * @param string $dir Directory containing migration files + * + * @throws Zend_Db_Schema_Exception + * + * @return array of file name, version and class name + */ + protected function _getMigrationFiles($currentVersion, $stopVersion, $dir = null) + { + if ($dir === null) { + $dir = $this->_dir; + } + + $direction = 'up'; + $from = $currentVersion; + $to = $stopVersion; + if($stopVersion < $currentVersion) { + $direction = 'down'; + $from = $stopVersion; + $to = $currentVersion; + } + + $files = array(); + if (!is_dir($dir) || !is_readable($dir)) { + return $files; + } + + $d = dir($dir); + $seen = array(); + while (false !== ($entry = $d->read())) { + if (preg_match('/^([0-9]+)\-(.*)\.php/i', $entry, $matches) ) { + $versionNumber = (int)$matches[1]; + if (isset($seen[$versionNumber])) { + throw new Zend_Db_Schema_Exception("version $versionNumber is used for multiple migrations."); + } + $seen[$versionNumber] = true; + $className = $matches[2]; + if ($versionNumber > $from && $versionNumber <= $to) { + $path = $this->_relativePath($this->_dir, $dir); + $files["v{$matches[1]}"] = array( + 'path'=>$path, + 'filename'=>$entry, + 'version'=>$versionNumber, + 'classname'=>$className); + } + } elseif ($entry != '.' && $entry != '..') { + $subdir = $dir . '/' . $entry; + if (is_dir($subdir) && is_readable($subdir)) { + $files = array_merge( + $files, + $this->_getMigrationFiles( + $currentVersion, $stopVersion, $subdir + ) + ); + } + } + } + $d->close(); + + if($direction == 'up') { + ksort($files); + } else { + krsort($files); + } + + return $files; + } + + /** + * Runs a migration file according to the information provided. The + * migration parameter is an array or object allowing ArrayAccess with the + * following fields: + * + * version - The version of the migration this file represents + * filename - The name of the file containing the code to upgrade or downgrade the database + * classname - The name of the class contained in the file + * + * The direction parameter should be one of either "up" or "down" and indicates + * which of the migration class methods should be executed. The up method is + * assumed to move the database schema to the next version while down is + * assumed to undo whatever up did. + * + * @param array|ArrayAccess $migration Information about the migration file + * @param string $direction "up" or "down" + * + * @throws Zend_Db_Schema_Exception + * + * @return null + * + * @todo I think there may be a problem with different migration files using + * the same class name. -- Confirmed. If you migrate single versions at a time, + * i.e. using increment or decrement then you will have no problems. If you + * try to migrate through files where there are more than one file with a + * particular class name, it will fail because it tries to redeclare a class + * that already exists. + */ + protected function _processFile($migration, $direction) + { + $path = $migration['path']; + $version = $migration['version']; + $filename = $migration['filename']; + $classname = $migration['classname']; + require_once($this->_dir.'/'.$path.'/'.$filename); + if (!class_exists($classname, false)) { + throw new Zend_Db_Schema_Exception("Could not find class '$classname' in file '$filename'"); + } + $class = new $classname($this->_db, $this->_tablePrefix); + $class->$direction(); + + if($direction == 'down') { + // current version is actually one lower than this version now + $version--; + } + $this->_updateSchemaVersion($version); + } + + /** + * Updates the schema version in the database. + * + * @param int $version Version to update into database + * + * @return null + */ + protected function _updateSchemaVersion($version) + { + $schemaVersionTableName = $this->getPrefixedSchemaVersionTableName(); + $sql = "UPDATE $schemaVersionTableName SET version = " . (int)$version; + $this->_db->query($sql); + } + + /** + * Retrieves the prefixed version of the schema version table. + * + * @return string + */ + public function getPrefixedSchemaVersionTableName() + { + return $this->_tablePrefix . $this->_schemaVersionTableName; + } + + /** + * Returns a relative path from one directory to another + * + * @param string $from Directory to start from + * @param string $to Directory to end at + * @param string $ps Path seperator + * + * @return string + */ + protected function _relativePath($from, $to, $ps = DIRECTORY_SEPARATOR) + { + $arFrom = explode($ps, rtrim($from, $ps)); + $arTo = explode($ps, rtrim($to, $ps)); + while (count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) { + array_shift($arFrom); + array_shift($arTo); + } + return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo); + } +} + diff --git a/library/Zend/Tool/DatabaseSchemaProvider.php b/library/Zend/Tool/DatabaseSchemaProvider.php new file mode 100644 index 0000000000..bdbe9b1127 --- /dev/null +++ b/library/Zend/Tool/DatabaseSchemaProvider.php @@ -0,0 +1,471 @@ +updateTo(null, $env, $dir); + } + + /** + * Allows you to change the database schema version by specifying the desired version. If you are + * upgrading (choosing a higher version), it will update to the highest version that is available. + * If you are downgrading, it will go to the highest version that is equal to or lower than the + * version you specified. + * + * @param string $version Version to change to + * @param string $env Environment to retrieve database credentials from, default is development + * @param string $dir Directory containing migration files, default is ./scripts/migrations + * + * @return boolean + */ + public function updateTo($version, $env='development', $dir='./scripts/migrations') + { + $this->_init($env); + $response = $this->_registry->getResponse(); + try { + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + + $result = $manager->updateTo($version); + + switch ($result) { + case Zend_Db_Schema_Manager::RESULT_AT_CURRENT_VERSION: + if (!$version) { + $version = $manager->getCurrentSchemaVersion(); + } + $response->appendContent("Already at version $version"); + break; + + case Zend_Db_Schema_Manager::RESULT_NO_MIGRATIONS_FOUND : + $response->appendContent("No migration files found to migrate from {$manager->getCurrentSchemaVersion()} to $version"); + break; + + default: + $response->appendContent('Schema updated to version ' . $manager->getCurrentSchemaVersion()); + } + + return true; + } catch (Exception $e) { + $response->appendContent('AN ERROR HAS OCCURED:'); + $response->appendContent($e->getMessage()); + $response->appendContent($e->getTraceAsString()); + return false; + } + } + + /** + * Decrements the database schema version to the next version or if specified + * down a specified number of versions. + * + * @param int $versions Number of versions to decrement. Default is 1 + * @param string $env Environment to read database credentials from + * @param string $dir Directory containing migration files + * + * @return boolean + */ + public function decrement($versions=1, $env='development', $dir='./scripts/migrations') + { + $this->_init($env); + $response = $this->_registry->getResponse(); + try { + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + + $result = $manager->decrementVersion($versions); + + switch ($result) { + case Zend_Db_Schema_Manager::RESULT_AT_MINIMUM_VERSION: + $response->appendContent("Already at minimum version " . $manager->getCurrentSchemaVersion()); + break; + + default: + $response->appendContent('Schema updated to version ' . $manager->getCurrentSchemaVersion()); + } + + return true; + } catch (Exception $e) { + $response->appendContent('AN ERROR HAS OCCURRED: '); + $response->appendContent($e->getMessage()); + $response->appendContent($e->getTraceAsString()); + return false; + } + } + + /** + * Increments the datbase schema version to the next version or up a specified + * number of versions + * + * @param int $versions Number of versions to increment. Default is 1 + * @param string $env Environment to read database conguration from + * @param string $dir Directory containing migration scripts + * + * @return booolean + */ + public function increment($versions=1,$env='development', $dir='./scripts/migrations') + { + $this->_init($env); + $response = $this->_registry->getResponse(); + try { + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + + $result = $manager->incrementVersion($versions); + + switch ($result) { + case Zend_Db_Schema_Manager::RESULT_AT_MAXIMUM_VERSION: + $response->appendContent("Already at maximum version " . $manager->getCurrentSchemaVersion()); + break; + + default: + $response->appendContent('Schema updated to version ' . $manager->getCurrentSchemaVersion()); + } + + return true; + } catch (Exception $e) { + $response->appendContent('AN ERROR HAS OCCURED:'); + $response->appendContent($e->getMessage()); + $response->appendContent($e->getTraceAsString()); + return false; + } + } + + /** + * Provide the current schema version number + * + * @return boolean + */ + public function current($env='development', $dir='./migrations') + { + $this->_init($env); + try { + + // Initialize and retrieve DB resource + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + echo 'Current schema version is ' . $manager->getCurrentSchemaVersion() . PHP_EOL; + + return true; + } catch (Exception $e) { + echo 'AN ERROR HAS OCCURED:' . PHP_EOL; + echo $e->getMessage() . PHP_EOL; + echo $e->getTraceAsString() . PHP_EOL; + return false; + } + } + + /** + * Retrieves the realpath for ./scripts/migrations. Does not appear to be + * used anywhere. Possible candidate for removal. + * + * @return string + * @deprecated + */ + protected function _getDirectory() + { + $dir = './scripts/migrations'; + return realpath($dir); + } + + /** + * Initializes the Akrabat functionality and adds it to Zend_Tool (zf) + * + * @param string $env Environment to initialize for + * + * @return null + * + * @throws Zend_Tool_Project_Exception + */ + protected function _init($env) + { + $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); + $appConfigFileResource = $profile->search('applicationConfigFile'); + + if ($appConfigFileResource == false) { + throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); + } + $appConfigFilePath = $appConfigFileResource->getPath(); + + // Base config, normally the application.ini in the configs dir of your app + $this->_config = $this->_createConfig($appConfigFilePath, $env, true); + + // Are there any override config files? + foreach($this->_getAppConfigOverridePathList($appConfigFilePath) as $path) { + $overrideConfig = $this->_createConfig($path); + if (isset($overrideConfig->$env)) { + $this->_config->merge($overrideConfig->$env); + } + } + + require_once 'Zend/Loader/Autoloader.php'; + $autoloader = Zend_Loader_Autoloader::getInstance(); + $autoloader->registerNamespace('Zend_'); + } + + /** + * Pull the akrabat section of the zf.ini + * + * @return Zend_Config_Ini|false Fasle if not set + */ + protected function _getUserConfig() + { + $userConfig = false; + if (isset($this->_registry->getConfig()->akrabat)) { + $userConfig = $this->_registry->getConfig()->akrabat; + } + return $userConfig; + } + + /** + * Create new Zend_Config object based on a filename + * + * Mostly a copy and paste from Zend_Application::_loadConfig + * + * @param string $filename File to create the object from + * @param string $section If not null, pull this sestion of the config + * file only. Doesn't apply to .php and .inc file + * @param string $allowModifications Should the object be mutable or not + * + * @throws Zend_Db_Schema_Exception + * + * @return Zend_Config + */ + protected function _createConfig($filename, $section = null, $allowModifications = false) { + + $options = false; + if ($allowModifications) { + $options = array('allowModifications' => true); + } + + $suffix = pathinfo($filename, PATHINFO_EXTENSION); + $suffix = ($suffix === 'dist') + ? pathinfo(basename($filename, ".$suffix"), PATHINFO_EXTENSION) + : $suffix; + + switch (strtolower($suffix)) { + case 'ini': + $config = new Zend_Config_Ini($filename, $section, $options); + break; + + case 'xml': + $config = new Zend_Config_Xml($filename, $section, $options); + break; + + case 'json': + $config = new Zend_Config_Json($filename, $section, $options); + break; + + case 'yaml': + case 'yml': + $config = new Zend_Config_Yaml($filename, $section, $options); + break; + + case 'php': + case 'inc': + $config = include $filename; + if (!is_array($config)) { + throw new Zend_Db_Schema_Exception( + 'Invalid configuration file provided; PHP file does not return array value' + ); + } + $config = new Zend_Config($config, $allowModifications); + break; + + default: + throw new Zend_Db_Schema_Exception( + 'Invalid configuration file provided; unknown config type' + ); + } + return $config; + } + + /** + * Will pull a list of file paths to application config overrides + * + * There is a deliberate attempt to be very forgiving. If a file doesn't exist, + * it won't be included in the list. If a the file doesn't have a section that + * corresponds the current target environment it don't be merged. + * + * The config files should be standalone, they will not be able to extend + * sections from the base config file. + * + * The ini, xml, json, yaml and php config file types are supported + * + * By default we will look for a "local.ini" in the applications configs + * directory. + * + * Config files are added with an order, the order run from lowest to highest. + * The "local.ini" file in this case will be given the order of 100 + * + * This can be disabled with the following in your .zf.ini: + * + * akrabat.appConfigOverride.skipLocal = true + * + * You can have add to the list of file names to look for in the configs + * directory by adding the following to the .zf.ini: + * + * akrabat.appConfigOverride.name = 'override.ini' + * + * You can only add one name with this approach and it will be added with the + * order of 200 + * + * To add mutiple names to be checked use the following in the .zf.ini: + * + * akrabat.appConfigOverride.name.60 = 'dev.ini' + * akrabat.appConfigOverride.name.50 = 'override.ini.ini' + * + * Where the last part of the config key is the order to merge the files. + * + * To add a path to be include, do the following in your .zf.ini: + * + * akrabat.appConfigOverride.path = '/home/user/projects/account/configs/local.ini' + * + * You can only add one path with this approach and it will be added with the + * order of 300 + * + * To add mutiple path use the following in the .zf.ini: + * + * akrabat.appConfigOverride.path.1 = './application/configs/dev.ini' + * akrabat.appConfigOverride.path.4 = '/home/user/projects/account/configs/local.ini' + * + * Where the last part of the config key is the order to merge the files. + * + * If a path is added with an order that clashes with another file then the + * path will be added the end of the queue + * + * @param string $appConfigFilePath + * + * @return array + */ + protected function _getAppConfigOverridePathList($appConfigFilePath) + { + $pathList = array(); + $appConfigDir = dirname($appConfigFilePath); + $userConfig = false; + + if ($this->_getUserConfig() !== false + && isset($this->_getUserConfig()->appConfigOverride) + ) { + $userConfig = $this->_getUserConfig()->appConfigOverride; + } + + $skipLocal = false; + if ($userConfig !== false && isset($userConfig->skipLocal)) { + $skipLocal = (bool)$userConfig->skipLocal; + } + + // The convention over configuration option + if ($skipLocal === false) { + $appConfigFilePathLocal = realpath($appConfigDir.'/local.ini'); + if ($appConfigFilePathLocal) { + $pathList[100] = $appConfigFilePathLocal; + } + } + + if ($userConfig === false) { + return $pathList; + } + + // Look for file names in the app configs dir + if (isset($userConfig->name)) { + if ($userConfig->name instanceof Zend_Config) { + $fileNameList = $userConfig->name->toArray(); + } else { + $fileNameList = array(200 => $userConfig->name); + } + + foreach($fileNameList as $order => $fileName) { + $path = realpath($appConfigDir.'/'.$fileName); + if ($path) { + $pathList[$order] = $appConfigDir.'/'.$fileName; + } + } + } + + // A full or relative path, app dir will not be prefixed + if (isset($userConfig->path)) { + if ($userConfig->path instanceof Zend_Config) { + $filePathList = $userConfig->path->toArray(); + } else { + $filePathList = array(300 => $userConfig->path); + } + + foreach($filePathList as $order => $filePath) { + if (file_exists($filePath) === false) { + continue; + } + if (isset($pathList[$order])) { + $pathList[] = $filePath; + } else { + $pathList[$order] = $filePath; + } + } + } + + ksort($pathList); + return $pathList; + } + + /** + * Retrieve initialized DB connection + * + * @return Zend_Db_Adapter_Interface + */ + protected function _getDbAdapter() + { + if ((null === $this->_db)) { + if($this->_config->resources->db){ + $dbConfig = $this->_config->resources->db; + $this->_db = Zend_Db::factory($dbConfig->adapter, $dbConfig->params); + } elseif($this->_config->resources->multidb){ + foreach ($this->_config->resources->multidb as $db) { + if($db->default){ + $this->_db = Zend_Db::factory($db->adapter, $db); + } + } + } + if($this->_db instanceof Zend_Db_Adapter_Interface) { + throw new Zend_Db_Schema_Exception('Database was not initialized'); + } + } + return $this->_db; + } + + /** + * Retrieve table prefix + * + * @return string + */ + public function getTablePrefix() + { + if ((null === $this->_tablePrefix)) { + $prefix = ''; + if (isset($this->_config->resources->db->table_prefix)) { + $prefix = $this->_config->resources->db->table_prefix . '_'; + } + $this->_tablePrefix = $prefix; + } + return $this->_tablePrefix; + } + +} From 5f6ddecd7ba0093a7eeae3a20c51cafe9b3339ca Mon Sep 17 00:00:00 2001 From: Shardj Date: Thu, 19 Dec 2019 15:09:23 +0000 Subject: [PATCH 55/60] version bump to 1.16.1 --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 116e93ef9a..5a6c252064 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.16.0'; + const VERSION = '1.16.1'; /** * The latest stable version Zend Framework available From f7d48ee6a6d74568b7603af72e897891eeff92ae Mon Sep 17 00:00:00 2001 From: Martijn Gastkemper Date: Wed, 8 Jan 2020 18:43:00 +0100 Subject: [PATCH 56/60] Replace curly brakets for PHP 7.4 compatibility --- .../license-agreement/generate-document-concat.php | 2 +- library/Zend/Amf/Util/BinaryStream.php | 2 +- library/Zend/Barcode/Object/Code25.php | 2 +- library/Zend/Barcode/Object/Ean13.php | 4 ++-- library/Zend/Barcode/Object/Ean5.php | 2 +- library/Zend/Barcode/Object/Ean8.php | 2 +- library/Zend/Barcode/Object/Identcode.php | 2 +- library/Zend/Barcode/Object/ObjectAbstract.php | 2 +- library/Zend/Barcode/Object/Upca.php | 2 +- library/Zend/Barcode/Object/Upce.php | 2 +- library/Zend/Db/Statement.php | 4 ++-- library/Zend/Json/Decoder.php | 10 +++++----- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php b/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php index 5f33ba2152..50afd1f08e 100755 --- a/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php +++ b/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php @@ -162,7 +162,7 @@ function randomString() for ($i = 0; $i < $stringLen; $i ++) { $pos = (rand() % $poolLen); - $ret .= $pool{$pos}; + $ret .= $pool[$pos]; } return $ret; diff --git a/library/Zend/Amf/Util/BinaryStream.php b/library/Zend/Amf/Util/BinaryStream.php index b56820a62f..2f5037a9cc 100644 --- a/library/Zend/Amf/Util/BinaryStream.php +++ b/library/Zend/Amf/Util/BinaryStream.php @@ -140,7 +140,7 @@ public function readByte() ); } - return ord($this->_stream{$this->_needle++}); + return ord($this->_stream[$this->_needle++]); } /** diff --git a/library/Zend/Barcode/Object/Code25.php b/library/Zend/Barcode/Object/Code25.php index 5ef4053eae..c55a4c5c04 100644 --- a/library/Zend/Barcode/Object/Code25.php +++ b/library/Zend/Barcode/Object/Code25.php @@ -132,7 +132,7 @@ public function getChecksum($text) $checksum = 0; for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * $factor; + $checksum += intval($text[$i - 1]) * $factor; $factor = 4 - $factor; } diff --git a/library/Zend/Barcode/Object/Ean13.php b/library/Zend/Barcode/Object/Ean13.php index 55a483b521..dfeb6782e7 100644 --- a/library/Zend/Barcode/Object/Ean13.php +++ b/library/Zend/Barcode/Object/Ean13.php @@ -166,7 +166,7 @@ public function getChecksum($text) $checksum = 0; for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * $factor; + $checksum += intval($text[$i - 1]) * $factor; $factor = 4 - $factor; } @@ -196,7 +196,7 @@ protected function _drawEan13Text() $leftPosition = $this->getQuietZone() - $characterWidth; for ($i = 0; $i < $this->_barcodeLength; $i ++) { $this->_addText( - $text{$i}, + $text[$i], $this->_fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Ean5.php b/library/Zend/Barcode/Object/Ean5.php index e0a93e0a23..1f074ba077 100644 --- a/library/Zend/Barcode/Object/Ean5.php +++ b/library/Zend/Barcode/Object/Ean5.php @@ -124,7 +124,7 @@ public function getChecksum($text) $checksum = 0; for ($i = 0 ; $i < $this->_barcodeLength; $i ++) { - $checksum += intval($text{$i}) * ($i % 2 ? 9 : 3); + $checksum += intval($text[$i]) * ($i % 2 ? 9 : 3); } return ($checksum % 10); diff --git a/library/Zend/Barcode/Object/Ean8.php b/library/Zend/Barcode/Object/Ean8.php index 53965d4c23..a3f9e4510c 100644 --- a/library/Zend/Barcode/Object/Ean8.php +++ b/library/Zend/Barcode/Object/Ean8.php @@ -123,7 +123,7 @@ protected function _drawText() $leftPosition = $this->getQuietZone() + (3 * $this->_barThinWidth) * $this->_factor; for ($i = 0; $i < $this->_barcodeLength; $i ++) { $this->_addText( - $text{$i}, + $text[$i], $this->_fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Identcode.php b/library/Zend/Barcode/Object/Identcode.php index a6f0081c05..69c1e126af 100644 --- a/library/Zend/Barcode/Object/Identcode.php +++ b/library/Zend/Barcode/Object/Identcode.php @@ -85,7 +85,7 @@ public function getChecksum($text) $checksum = 0; for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * (($i % 2) ? 4 : 9); + $checksum += intval($text[$i - 1]) * (($i % 2) ? 4 : 9); } $checksum = (10 - ($checksum % 10)) % 10; diff --git a/library/Zend/Barcode/Object/ObjectAbstract.php b/library/Zend/Barcode/Object/ObjectAbstract.php index e942a4ad1a..b40a5a8c6e 100644 --- a/library/Zend/Barcode/Object/ObjectAbstract.php +++ b/library/Zend/Barcode/Object/ObjectAbstract.php @@ -1322,7 +1322,7 @@ protected function _drawText() for ($i = 0; $i < $textLength; $i ++) { $leftPosition = $this->getQuietZone() + $space * ($i + 0.5); $this->_addText( - $text{$i}, + $text[$i], $this->_fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Upca.php b/library/Zend/Barcode/Object/Upca.php index b9eaae73fa..dd06705c5a 100644 --- a/library/Zend/Barcode/Object/Upca.php +++ b/library/Zend/Barcode/Object/Upca.php @@ -140,7 +140,7 @@ protected function _drawText() $fontSize *= 0.8; } $this->_addText( - $text{$i}, + $text[$i], $fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Upce.php b/library/Zend/Barcode/Object/Upce.php index 8302b698f1..5cccee53e3 100644 --- a/library/Zend/Barcode/Object/Upce.php +++ b/library/Zend/Barcode/Object/Upce.php @@ -158,7 +158,7 @@ protected function _drawText() $fontSize *= 0.8; } $this->_addText( - $text{$i}, + $text[$i], $fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Db/Statement.php b/library/Zend/Db/Statement.php index be5e2d5912..ce0e64cf3c 100644 --- a/library/Zend/Db/Statement.php +++ b/library/Zend/Db/Statement.php @@ -191,9 +191,9 @@ protected function _stripQuoted($sql) if (!empty($q)) { $escapeChar = preg_quote($escapeChar); // this segfaults only after 65,000 characters instead of 9,000 - $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql); + $sql = preg_replace("/$q([^$q[$escapeChar]]*|($qe)*)*$q/s", '', $sql); } - + // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index cc83115199..6cc569c478 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -324,7 +324,7 @@ protected function _getNextToken() $i = $this->_offset; $start = $i; - switch ($str{$i}) { + switch ($str[$i]) { case '{': $this->_token = self::LBRACE; break; @@ -351,14 +351,14 @@ protected function _getNextToken() break; } - $chr = $str{$i}; + $chr = $str[$i]; if ($chr == '\\') { $i++; if ($i >= $str_length) { break; } - $chr = $str{$i}; + $chr = $str[$i]; switch ($chr) { case '"' : $result .= '"'; @@ -431,7 +431,7 @@ protected function _getNextToken() return($this->_token); } - $chr = $str{$i}; + $chr = $str[$i]; if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) { if (preg_match('/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s', $str, $matches, PREG_OFFSET_CAPTURE, $start) && $matches[0][1] == $start) { @@ -494,7 +494,7 @@ public static function decodeUnicodeString($chrs) $i += 5; break; case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): - $utf8 .= $chrs{$i}; + $utf8 .= $chrs[$i]; break; case ($ord_chrs_c & 0xE0) == 0xC0: // characters U-00000080 - U-000007FF, mask 110XXXXX From e7707b1618546d94058769bd200c6ac34402ea53 Mon Sep 17 00:00:00 2001 From: Martijn Gastkemper Date: Thu, 9 Jan 2020 13:51:40 +0100 Subject: [PATCH 57/60] fixup! Replace curly brakets for PHP 7.4 compatibility --- library/Zend/Db/Statement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Statement.php b/library/Zend/Db/Statement.php index ce0e64cf3c..f544dfc8a2 100644 --- a/library/Zend/Db/Statement.php +++ b/library/Zend/Db/Statement.php @@ -191,7 +191,7 @@ protected function _stripQuoted($sql) if (!empty($q)) { $escapeChar = preg_quote($escapeChar); // this segfaults only after 65,000 characters instead of 9,000 - $sql = preg_replace("/$q([^$q[$escapeChar]]*|($qe)*)*$q/s", '', $sql); + $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql); } // get a version of the SQL statement with all quoted From 86da9b52c90bd6f8ec65b0c65de93e954e80f986 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 13 Jan 2020 11:26:18 +0000 Subject: [PATCH 58/60] corrects docblock return typehint --- library/Zend/Db/Adapter/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Adapter/Abstract.php b/library/Zend/Db/Adapter/Abstract.php index 9f857c6a54..728bbbba52 100644 --- a/library/Zend/Db/Adapter/Abstract.php +++ b/library/Zend/Db/Adapter/Abstract.php @@ -727,7 +727,7 @@ public function getFetchMode() * @param string|Zend_Db_Select $sql An SQL SELECT statement. * @param mixed $bind Data to bind into SELECT placeholders. * @param mixed $fetchMode Override current fetch mode. - * @return array + * @return array|null */ public function fetchAll($sql, $bind = array(), $fetchMode = null) { From 5621e192aaad3191bb7bf0b3921d69e95837330c Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 13 Jan 2020 11:29:24 +0000 Subject: [PATCH 59/60] version bump --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 5a6c252064..6ce2680fc3 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.16.1'; + const VERSION = '1.16.2'; /** * The latest stable version Zend Framework available From 943f136b0eeb9c6635748d6f2a892bfbe924848e Mon Sep 17 00:00:00 2001 From: gdiamantg Date: Mon, 3 Feb 2020 15:03:33 +0000 Subject: [PATCH 60/60] Address iconv_substr incompatibility between php 5.x and 7.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (PHP 5, PHP 7) iconv_substr — Cut out part of a string Description iconv_substr ( string $str , int $offset [, int $length = iconv_strlen($str, $charset) [, string $charset = ini_get("iconv.internal_encoding") ]] ) : string ... Version Description 7.0.11 If str is equal to offset characters long, an empty string will be returned. Prior to this version, FALSE was returned in this case. Because of the above change, ZF1 fails to successfully initialise a DateTime object when necessary information is missing from the value provided leading to unhandled exception. --- library/Zend/Locale/Format.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 517dcbb415..c520ffe9a0 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -925,7 +925,7 @@ private static function _parseDate($date, $options) $result['day'] = $splitted[0][$cnt]; } } else { - $result['day'] = iconv_substr($splitted[0][0], $split, 2); + $result['day'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -936,7 +936,7 @@ private static function _parseDate($date, $options) $result['month'] = $splitted[0][$cnt]; } } else { - $result['month'] = iconv_substr($splitted[0][0], $split, 2); + $result['month'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -953,7 +953,7 @@ private static function _parseDate($date, $options) $result['year'] = $splitted[0][$cnt]; } } else { - $result['year'] = iconv_substr($splitted[0][0], $split, $length); + $result['year'] = (iconv_substr($splitted[0][0], $split, $length)?: false); $split += $length; } @@ -965,7 +965,7 @@ private static function _parseDate($date, $options) $result['hour'] = $splitted[0][$cnt]; } } else { - $result['hour'] = iconv_substr($splitted[0][0], $split, 2); + $result['hour'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -976,7 +976,7 @@ private static function _parseDate($date, $options) $result['minute'] = $splitted[0][$cnt]; } } else { - $result['minute'] = iconv_substr($splitted[0][0], $split, 2); + $result['minute'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -987,7 +987,7 @@ private static function _parseDate($date, $options) $result['second'] = $splitted[0][$cnt]; } } else { - $result['second'] = iconv_substr($splitted[0][0], $split, 2); + $result['second'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt;