diff --git a/README.md b/README.md index 89722310b9..d427234718 100644 --- a/README.md +++ b/README.md @@ -2,173 +2,24 @@ 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) +USAGE +===== -RELEASE INFORMATION -=================== +``` +composer require plesk/zf1 +``` -Zend Framework 1.12.17dev Release. -Released on MMM DD, YYYY. +https://packagist.org/packages/plesk/zf1 -IMPORTANT FIXES FOR 1.12.17 ---------------------------- - -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 +HOW TO PREPARE RELEASE ====================== -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. +``` +git checkout -b 1.12.17-plesk-min-4 +docker run -it -v $(pwd):/root/ ubuntu /root/build.sh +git add . +git commit +git push --set-upstream origin 1.12.17-plesk-min-4 +git tag 1.12.17-patch4 +git push origin 1.12.17-patch4 +``` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..9ab769a615 --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash +### Copyright 1999-2017. Plesk International GmbH. All rights reserved. + +cd `dirname $0` + +rm -rf CONTRIBUTING.md +rm -rf DEVELOPMENT_README.md +rm -rf INSTALL.md +rm -rf README-GIT.md +rm -rf README.md +rm -rf Vagrantfile +rm -rf bin +rm -rf build.sh +rm -rf demos +rm -rf documentation +rm -rf puppet +rm -rf resources +rm -rf tests + +pushd library + echo "Remove some unused components..." + rm -rf Zend/Amf + rm -rf Zend/Barcode + rm -rf Zend/Captcha + rm -rf Zend/Cloud + rm -rf Zend/CodeGenerator + rm -rf Zend/Dojo + rm -rf Zend/Measure + rm -rf Zend/Mobile + rm -rf Zend/Pdf + rm -rf Zend/Search + rm -rf Zend/Service + rm -rf Zend/Tool + + echo "Remove require_once..." + find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' \ + -not -wholename '*/Application.php' -not -wholename '*/Loader.php' \ + -print0 | \ + xargs -0 sed --regexp-extended -i -e 's/(require_once)/;\/\/ \1/g' +popd diff --git a/composer.json b/composer.json index eb84b09649..3bafaaf04c 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "zendframework/zendframework1", - "description": "Zend Framework 1", + "name": "plesk/zf1", + "description": "Zend Framework 1 (Plesk)", "type": "library", "keywords": [ "framework", @@ -9,7 +9,7 @@ "homepage": "http://framework.zend.com/", "license": "BSD-3-Clause", "require": { - "php": ">=5.2.11" + "php": ">=5.6" }, "autoload": { "psr-0": { @@ -19,19 +19,23 @@ "include-path": [ "library/" ], - "config": { - "bin-dir": "bin" - }, "extra": { "branch-alias": { "dev-master": "1.12.x-dev" } }, "require-dev": { - "phpunit/phpunit": "3.7.*", - "phpunit/dbunit": "1.3.*" + "phpunit/phpunit": "^4", + "phpunit/dbunit": "*" }, "archive": { - "exclude": ["/demos", "/documentation", "/tests"] + "exclude": [ + "/demos", + "/documentation", + "/tests" + ] + }, + "scripts": { + "test": "phpunit" } } diff --git a/demos/Zend/Gdata/BooksBrowser/index.php b/demos/Zend/Gdata/BooksBrowser/index.php index 23d03fa4b0..0b766ed66d 100755 --- a/demos/Zend/Gdata/BooksBrowser/index.php +++ b/demos/Zend/Gdata/BooksBrowser/index.php @@ -90,7 +90,7 @@ function echoBookList($feed) $thumbnail_img - $title
+ $title
$creators
$preview_link diff --git a/demos/Zend/Gdata/YouTubeVideoApp/operations.php b/demos/Zend/Gdata/YouTubeVideoApp/operations.php index afa62b90d1..fdb3bdeab0 100755 --- a/demos/Zend/Gdata/YouTubeVideoApp/operations.php +++ b/demos/Zend/Gdata/YouTubeVideoApp/operations.php @@ -462,10 +462,10 @@ function createUploadForm($videoTitle, $videoDescription, $videoCategory, $video } print <<< END -
- +
END; @@ -747,9 +747,9 @@ function echoVideoPlayer($videoId) print <<$videoTitle
- + - END; @@ -831,15 +831,15 @@ function echoVideoMetadata($entry) } $flashUrl = htmlspecialchars(findFlashUrl($entry)); print <<Title: ${title}
- Description: ${description}
- Author: ${authorUsername}
- Tags: ${tags}
- Duration: ${duration} seconds
- View count: ${viewCount}
- Rating: ${rating} (${numRaters} ratings)
- Flash: ${flashUrl}
- Watch page: ${watchPage}
+ Title: {$title}
+ Description: {$description}
+ Author: {$authorUsername}
+ Tags: {$tags}
+ Duration: {$duration} seconds
+ View count: {$viewCount}
+ Rating: {$rating} ({$numRaters} ratings)
+ Flash: {$flashUrl}
+ Watch page: {$watchPage}
END; } diff --git a/demos/Zend/Gdata/YouTubeVideoBrowser/index.php b/demos/Zend/Gdata/YouTubeVideoBrowser/index.php index 6b9dc38ec4..74d7f56254 100755 --- a/demos/Zend/Gdata/YouTubeVideoBrowser/index.php +++ b/demos/Zend/Gdata/YouTubeVideoBrowser/index.php @@ -141,9 +141,9 @@ function echoVideoPlayer($videoId) print <<$videoTitle
- + - END; @@ -175,15 +175,15 @@ function echoVideoMetadata($entry) $numRaters = $entry->rating->numRaters; $flashUrl = findFlashUrl($entry); print <<Title: ${title}
- Description: ${description}
- Author: ${authorUsername}
- Tags: ${tags}
- Duration: ${duration} seconds
- View count: ${viewCount}
- Rating: ${rating} (${numRaters} ratings)
- Flash: ${flashUrl}
- Watch page: ${watchPage}
+ Title: {$title}
+ Description: {$description}
+ Author: {$authorUsername}
+ Tags: {$tags}
+ Duration: {$duration} seconds
+ View count: {$viewCount}
+ Rating: {$rating} ({$numRaters} ratings)
+ Flash: {$flashUrl}
+ Watch page: {$watchPage}
END; } @@ -203,11 +203,11 @@ function echoVideoList($feed) $videoTitle = $entry->mediaGroup->title; $videoDescription = $entry->mediaGroup->description; print << - + + - ${videoTitle} -

${videoDescription}

+ {$videoTitle} +

{$videoDescription}

END; 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 cbb5b9bd3e..5cccee53e3 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; } @@ -158,7 +158,7 @@ protected function _drawText() $fontSize *= 0.8; } $this->_addText( - $text{$i}, + $text[$i], $fontSize * $this->_factor, $this->_rotate( $leftPosition, @@ -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/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/Cloud/DocumentService/Document.php b/library/Zend/Cloud/DocumentService/Document.php index 1d49d4411d..149543d155 100644 --- a/library/Zend/Cloud/DocumentService/Document.php +++ b/library/Zend/Cloud/DocumentService/Document.php @@ -161,7 +161,7 @@ public function __set($name, $value) * @param string $name * @return bool */ - public function offsetExists($name) + public function offsetExists($name): bool { return isset($this->_fields[$name]); } @@ -172,7 +172,7 @@ public function offsetExists($name) * @param string $name * @return mixed */ - public function offsetGet($name) + public function offsetGet($name): mixed { return $this->getField($name); } @@ -184,7 +184,7 @@ public function offsetGet($name) * @param mixed $value * @return void */ - public function offsetSet($name, $value) + public function offsetSet($name, $value): void { $this->setField($name, $value); } @@ -195,7 +195,7 @@ public function offsetSet($name, $value) * @param string $name * @return void */ - public function offsetUnset($name) + public function offsetUnset($name): void { if ($this->offsetExists($name)) { unset($this->_fields[$name]); @@ -231,7 +231,7 @@ public function __call($name, $args) * * @return int */ - public function count() + public function count(): int { return count($this->_fields); } @@ -241,7 +241,7 @@ public function count() * * @return Iterator */ - public function getIterator() + public function getIterator(): Iterator { return new ArrayIterator($this->_fields); } diff --git a/library/Zend/Cloud/DocumentService/DocumentSet.php b/library/Zend/Cloud/DocumentService/DocumentSet.php index 3c8b541176..6cde9da3f0 100644 --- a/library/Zend/Cloud/DocumentService/DocumentSet.php +++ b/library/Zend/Cloud/DocumentService/DocumentSet.php @@ -51,7 +51,7 @@ public function __construct(array $documents) * * @return int */ - public function count() + public function count(): int { return $this->_documentCount; } @@ -61,7 +61,7 @@ public function count() * * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return $this->_documents; } diff --git a/library/Zend/Cloud/Infrastructure/ImageList.php b/library/Zend/Cloud/Infrastructure/ImageList.php index 21e3a89bf0..01cc3f6a1f 100644 --- a/library/Zend/Cloud/Infrastructure/ImageList.php +++ b/library/Zend/Cloud/Infrastructure/ImageList.php @@ -87,7 +87,7 @@ protected function addImage(Zend_Cloud_Infrastructure_Image $image) * * @return int */ - public function count() + public function count(): int { return count($this->images); } @@ -97,9 +97,9 @@ public function count() * * Implement Iterator::current() * - * @return Image + * @return Zend_Cloud_Infrastructure_Image|null */ - public function current() + public function current(): ?Zend_Cloud_Infrastructure_Image { return $this->images[$this->iteratorKey]; } @@ -111,7 +111,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -123,7 +123,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey++; } @@ -135,7 +135,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -147,7 +147,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -164,7 +164,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -176,9 +176,9 @@ public function offsetExists($offset) * * @param int $offset * @throws Zend_Cloud_Infrastructure_Exception - * @return Image + * @return Zend_Cloud_Infrastructure_Image */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Cloud_Infrastructure_Image { if (!$this->offsetExists($offset)) { require_once 'Zend/Cloud/Infrastructure/Exception.php'; @@ -196,7 +196,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Cloud_Infrastructure_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Cloud/Infrastructure/Exception.php'; throw new Zend_Cloud_Infrastructure_Exception('You are trying to set read-only property'); @@ -210,7 +210,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Cloud_Infrastructure_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Cloud/Infrastructure/Exception.php'; throw new Zend_Cloud_Infrastructure_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Cloud/Infrastructure/InstanceList.php b/library/Zend/Cloud/Infrastructure/InstanceList.php index 02ff7b2856..75a86928e9 100644 --- a/library/Zend/Cloud/Infrastructure/InstanceList.php +++ b/library/Zend/Cloud/Infrastructure/InstanceList.php @@ -88,7 +88,7 @@ protected function addInstance(Zend_Cloud_Infrastructure_Instance $instance) * * @return int */ - public function count() + public function count(): int { return count($this->instances); } @@ -98,9 +98,9 @@ public function count() * * Implement Iterator::current() * - * @return Instance + * @return Zend_Cloud_Infrastructure_Instance|null */ - public function current() + public function current(): ?Zend_Cloud_Infrastructure_Instance { return $this->instances[$this->iteratorKey]; } @@ -112,7 +112,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -124,7 +124,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey++; } @@ -136,7 +136,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -148,7 +148,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -165,7 +165,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -176,10 +176,10 @@ public function offsetExists($offset) * Implement ArrayAccess::offsetGet() * * @param int $offset - * @return Instance + * @return Zend_Cloud_Infrastructure_Instance * @throws Zend_Cloud_Infrastructure_Exception */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Cloud_Infrastructure_Instance { if (!$this->offsetExists($offset)) { require_once 'Zend/Cloud/Infrastructure/Exception.php'; @@ -197,7 +197,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Cloud_Infrastructure_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Cloud/Infrastructure/Exception.php'; throw new Zend_Cloud_Infrastructure_Exception('You are trying to set read-only property'); @@ -211,7 +211,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Cloud_Infrastructure_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Cloud/Infrastructure/Exception.php'; throw new Zend_Cloud_Infrastructure_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Cloud/QueueService/MessageSet.php b/library/Zend/Cloud/QueueService/MessageSet.php index d80e935ed2..bc2d92c01f 100644 --- a/library/Zend/Cloud/QueueService/MessageSet.php +++ b/library/Zend/Cloud/QueueService/MessageSet.php @@ -51,7 +51,7 @@ public function __construct(array $messages) * * @return int */ - public function count() + public function count(): int { return $this->_messageCount; } @@ -61,7 +61,7 @@ public function count() * * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return $this->_messages; } diff --git a/library/Zend/Config.php b/library/Zend/Config.php index a39a1f2255..8bd8c2a9f7 100644 --- a/library/Zend/Config.php +++ b/library/Zend/Config.php @@ -245,7 +245,7 @@ public function __unset($name) * * @return int */ - public function count() + public function count(): int { return $this->_count; } @@ -255,7 +255,7 @@ public function count() * * @return mixed */ - public function current() + public function current(): mixed { $this->_skipNextIteration = false; return current($this->_data); @@ -266,7 +266,7 @@ public function current() * * @return mixed */ - public function key() + public function key(): mixed { return key($this->_data); } @@ -275,7 +275,7 @@ public function key() * Defined by Iterator interface * */ - public function next() + public function next(): void { if ($this->_skipNextIteration) { $this->_skipNextIteration = false; @@ -289,7 +289,7 @@ public function next() * Defined by Iterator interface * */ - public function rewind() + public function rewind(): void { $this->_skipNextIteration = false; reset($this->_data); @@ -301,7 +301,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return $this->_index < $this->_count; } diff --git a/library/Zend/Config/Writer/Ini.php b/library/Zend/Config/Writer/Ini.php index 15344a5b74..55bef62d03 100644 --- a/library/Zend/Config/Writer/Ini.php +++ b/library/Zend/Config/Writer/Ini.php @@ -153,7 +153,7 @@ protected function _prepareValue($value) return $value; } elseif (is_bool($value)) { return ($value ? 'true' : 'false'); - } elseif (strpos($value, '"') === false) { + } elseif (strpos(strval($value), '"') === false) { return '"' . $value . '"'; } else { /** @see Zend_Config_Exception */ diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 57fe9ecdee..776d974595 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -269,7 +269,7 @@ public function clearCurrentMessages($namespace = null) * * @return ArrayObject */ - public function getIterator($namespace = null) + public function getIterator($namespace = null): ArrayObject { if (!is_string($namespace) || $namespace == '') { $namespace = $this->getNamespace(); diff --git a/library/Zend/Controller/Action/HelperBroker/PriorityStack.php b/library/Zend/Controller/Action/HelperBroker/PriorityStack.php index d510b74ee5..fd88ca868f 100644 --- a/library/Zend/Controller/Action/HelperBroker/PriorityStack.php +++ b/library/Zend/Controller/Action/HelperBroker/PriorityStack.php @@ -86,9 +86,9 @@ public function push(Zend_Controller_Action_Helper_Abstract $helper) /** * Return something iterable * - * @return array + * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayObject($this->_helpersByPriority); } @@ -97,9 +97,9 @@ public function getIterator() * offsetExists() * * @param int|string $priorityOrHelperName - * @return Zend_Controller_Action_HelperBroker_PriorityStack + * @return bool */ - public function offsetExists($priorityOrHelperName) + public function offsetExists($priorityOrHelperName): bool { if (is_string($priorityOrHelperName)) { return array_key_exists($priorityOrHelperName, $this->_helpersByNameRef); @@ -114,7 +114,7 @@ public function offsetExists($priorityOrHelperName) * @param int|string $priorityOrHelperName * @return Zend_Controller_Action_HelperBroker_PriorityStack */ - public function offsetGet($priorityOrHelperName) + public function offsetGet($priorityOrHelperName): Zend_Controller_Action_HelperBroker_PriorityStack { if (!$this->offsetExists($priorityOrHelperName)) { require_once 'Zend/Controller/Action/Exception.php'; @@ -135,6 +135,7 @@ public function offsetGet($priorityOrHelperName) * @param Zend_Controller_Action_Helper_Abstract $helper * @return Zend_Controller_Action_HelperBroker_PriorityStack */ + #[ReturnTypeWillChange] public function offsetSet($priority, $helper) { $priority = (int) $priority; @@ -172,6 +173,7 @@ public function offsetSet($priority, $helper) * @param int|string $priorityOrHelperName Priority integer or the helper name * @return Zend_Controller_Action_HelperBroker_PriorityStack */ + #[ReturnTypeWillChange] public function offsetUnset($priorityOrHelperName) { if (!$this->offsetExists($priorityOrHelperName)) { @@ -198,7 +200,7 @@ public function offsetUnset($priorityOrHelperName) * * @return int */ - public function count() + public function count(): int { return count($this->_helpersByPriority); } diff --git a/library/Zend/Controller/Request/Http.php b/library/Zend/Controller/Request/Http.php index e997774905..9a48504890 100644 --- a/library/Zend/Controller/Request/Http.php +++ b/library/Zend/Controller/Request/Http.php @@ -390,10 +390,7 @@ public function getEnv($key = null, $default = null) public function setRequestUri($requestUri = null) { if ($requestUri === null) { - if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { - // IIS with Microsoft Rewrite Module - $requestUri = $_SERVER['HTTP_X_ORIGINAL_URL']; - } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // IIS with ISAPI_Rewrite $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif ( diff --git a/library/Zend/Controller/Router/Route.php b/library/Zend/Controller/Router/Route.php index 927b97b3d3..e4a56838a7 100644 --- a/library/Zend/Controller/Router/Route.php +++ b/library/Zend/Controller/Router/Route.php @@ -272,11 +272,11 @@ public function match($path, $partial = false) // Translate value if required $part = $this->_parts[$pos]; if ($this->_isTranslated - && (substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@' + && ($part !== null && substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@' && $name === null) || $name !== null && in_array($name, $this->_translatable) ) { - if (substr($part, 0, 1) === '@') { + if ($part !== null && substr($part, 0, 1) === '@') { $part = substr($part, 1); } @@ -285,7 +285,7 @@ public function match($path, $partial = false) } } - if (substr($part, 0, 2) === '@@') { + if ($part !== null && substr($part, 0, 2) === '@@') { $part = substr($part, 1); } diff --git a/library/Zend/Controller/Router/Route/Chain.php b/library/Zend/Controller/Router/Route/Chain.php index a474931ac5..ee2c6c0163 100644 --- a/library/Zend/Controller/Router/Route/Chain.php +++ b/library/Zend/Controller/Router/Route/Chain.php @@ -48,6 +48,8 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab */ protected $_separators = array(); + protected ?Zend_Controller_Request_Abstract $_request = null; + /** * Instantiates route based on passed Zend_Config structure * diff --git a/library/Zend/Controller/Router/Route/Module.php b/library/Zend/Controller/Router/Route/Module.php index 581a89b1bc..81ec48de13 100644 --- a/library/Zend/Controller/Router/Route/Module.php +++ b/library/Zend/Controller/Router/Route/Module.php @@ -267,7 +267,7 @@ public function assemble($data = array(), $reset = false, $encode = true, $parti } } else { if ($encode) { - $value = urlencode($value); + $value = urlencode(strval($value)); } $url .= self::URI_DELIMITER . $key; $url .= self::URI_DELIMITER . $value; diff --git a/library/Zend/Crypt/Rsa/Key.php b/library/Zend/Crypt/Rsa/Key.php index fafde02f57..e35ee1d96d 100644 --- a/library/Zend/Crypt/Rsa/Key.php +++ b/library/Zend/Crypt/Rsa/Key.php @@ -83,7 +83,7 @@ public function __toString() return $this->toString(); } - public function count() + public function count(): int { return $this->_details['bits']; } diff --git a/library/Zend/Db/Adapter/Pdo/Abstract.php b/library/Zend/Db/Adapter/Pdo/Abstract.php index cf2ecbdc2a..7fbbbe1146 100644 --- a/library/Zend/Db/Adapter/Pdo/Abstract.php +++ b/library/Zend/Db/Adapter/Pdo/Abstract.php @@ -293,7 +293,7 @@ protected function _quote($value) return $value; } // Fix for null-byte injection - $value = addcslashes($value, "\000\032"); + $value = addcslashes(strval($value), "\000\032"); $this->_connect(); return $this->_connection->quote($value); } diff --git a/library/Zend/Db/Statement.php b/library/Zend/Db/Statement.php index be5e2d5912..48b5e13c71 100644 --- a/library/Zend/Db/Statement.php +++ b/library/Zend/Db/Statement.php @@ -197,7 +197,7 @@ protected function _stripQuoted($sql) // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" - $sql = preg_replace("/\"(\\\\\"|[^\"])*\"/Us", '', $sql); + $sql = preg_replace("/\"(\\\\\"|[^\"])*\"/Us", '', $sql ?? ''); // get the character for delimited id quotes, // this is usually " but in MySQL is ` diff --git a/library/Zend/Db/Statement/Pdo.php b/library/Zend/Db/Statement/Pdo.php index b11bc6c7b1..ef7d16ec5a 100644 --- a/library/Zend/Db/Statement/Pdo.php +++ b/library/Zend/Db/Statement/Pdo.php @@ -251,7 +251,11 @@ public function fetch($style = null, $cursor = null, $offset = null) $style = $this->_fetchMode; } try { - return $this->_stmt->fetch($style, $cursor, $offset); + return $this->_stmt->fetch( + $style ?? PDO::FETCH_DEFAULT, + $cursor ?? PDO::FETCH_ORI_NEXT, + $offset ?? 0 + ); } catch (PDOException $e) { require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); @@ -263,7 +267,7 @@ public function fetch($style = null, $cursor = null, $offset = null) * * @return IteratorIterator */ - public function getIterator() + public function getIterator(): Traversable { return new IteratorIterator($this->_stmt); } diff --git a/library/Zend/Db/Table/Abstract.php b/library/Zend/Db/Table/Abstract.php index 66aa60545a..7134973e1f 100644 --- a/library/Zend/Db/Table/Abstract.php +++ b/library/Zend/Db/Table/Abstract.php @@ -1304,7 +1304,9 @@ public function find() $whereList = array(); $numberTerms = 0; foreach ($args as $keyPosition => $keyValues) { - $keyValuesCount = count($keyValues); + $keyValuesCount = is_array($keyValues) || $keyValues instanceof Countable + ? count($keyValues) + : (int)(null !== $keyValues); // Coerce the values to an array. // Don't simply typecast to array, because the values // might be Zend_Db_Expr objects. diff --git a/library/Zend/Db/Table/Row/Abstract.php b/library/Zend/Db/Table/Row/Abstract.php index 7e2d7b6752..e276f90fcb 100644 --- a/library/Zend/Db/Table/Row/Abstract.php +++ b/library/Zend/Db/Table/Row/Abstract.php @@ -263,7 +263,7 @@ public function __wakeup() * @param string $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return $this->__isset($offset); } @@ -273,9 +273,9 @@ public function offsetExists($offset) * Required by the ArrayAccess implementation * * @param string $offset - * @return string + * @return string|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?string { return $this->__get($offset); } @@ -287,7 +287,7 @@ public function offsetGet($offset) * @param string $offset * @param mixed $value */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->__set($offset, $value); } @@ -298,6 +298,7 @@ public function offsetSet($offset, $value) * * @param string $offset */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { return $this->__unset($offset); @@ -642,7 +643,7 @@ public function delete() return $result; } - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator((array) $this->_data); } diff --git a/library/Zend/Db/Table/Rowset/Abstract.php b/library/Zend/Db/Table/Rowset/Abstract.php index abace7bbde..acffb65608 100644 --- a/library/Zend/Db/Table/Rowset/Abstract.php +++ b/library/Zend/Db/Table/Rowset/Abstract.php @@ -227,6 +227,7 @@ public function getTableClass() * * @return Zend_Db_Table_Rowset_Abstract Fluent interface. */ + #[ReturnTypeWillChange] public function rewind() { $this->_pointer = 0; @@ -238,9 +239,9 @@ public function rewind() * Similar to the current() function for arrays in PHP * Required by interface Iterator. * - * @return Zend_Db_Table_Row_Abstract current element from the collection + * @return Zend_Db_Table_Row_Abstract|null current element from the collection */ - public function current() + public function current(): ?Zend_Db_Table_Row_Abstract { if ($this->valid() === false) { return null; @@ -257,7 +258,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->_pointer; } @@ -269,7 +270,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { ++$this->_pointer; } @@ -281,7 +282,7 @@ public function next() * * @return bool False if there's nothing more to iterate over */ - public function valid() + public function valid(): bool { return $this->_pointer >= 0 && $this->_pointer < $this->_count; } @@ -293,7 +294,7 @@ public function valid() * * @return int */ - public function count() + public function count(): int { return $this->_count; } @@ -306,6 +307,7 @@ public function count() * @return Zend_Db_Table_Rowset_Abstract * @throws Zend_Db_Table_Rowset_Exception */ + #[ReturnTypeWillChange] public function seek($position) { $position = (int) $position; @@ -324,7 +326,7 @@ public function seek($position) * @param string $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->_data[(int) $offset]); } @@ -336,7 +338,7 @@ public function offsetExists($offset) * @param string $offset * @return Zend_Db_Table_Row_Abstract */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Db_Table_Row_Abstract { $offset = (int) $offset; if ($offset < 0 || $offset >= $this->_count) { @@ -355,7 +357,7 @@ public function offsetGet($offset) * @param string $offset * @param mixed $value */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { } @@ -365,7 +367,7 @@ public function offsetSet($offset, $value) * * @param string $offset */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { } diff --git a/library/Zend/Dojo/Data.php b/library/Zend/Dojo/Data.php index 8d59e78400..f01ec87ebc 100644 --- a/library/Zend/Dojo/Data.php +++ b/library/Zend/Dojo/Data.php @@ -420,7 +420,7 @@ public function __toString() * @param string|int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return (null !== $this->getItem($offset)); } @@ -431,7 +431,7 @@ public function offsetExists($offset) * @param string|int $offset * @return array */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->getItem($offset); } @@ -443,7 +443,7 @@ public function offsetGet($offset) * @param array|object|null $value * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->setItem($value, $offset); } @@ -454,7 +454,7 @@ public function offsetSet($offset, $value) * @param string $offset * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { $this->removeItem($offset); } @@ -472,9 +472,9 @@ public function current() /** * Iterator: get current key * - * @return string|int + * @return string|int|null */ - public function key() + public function key(): string|int|null { return key($this->_items); } @@ -484,6 +484,7 @@ public function key() * * @return void */ + #[ReturnTypeWillChange] public function next() { return next($this->_items); @@ -494,6 +495,7 @@ public function next() * * @return void */ + #[ReturnTypeWillChange] public function rewind() { return reset($this->_items); @@ -504,7 +506,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { return (bool) $this->current(); } @@ -514,7 +516,7 @@ public function valid() * * @return int */ - public function count() + public function count(): int { return count($this->_items); } diff --git a/library/Zend/Dom/Query/Result.php b/library/Zend/Dom/Query/Result.php index ab5bd0eda6..b87f2fef63 100644 --- a/library/Zend/Dom/Query/Result.php +++ b/library/Zend/Dom/Query/Result.php @@ -120,6 +120,7 @@ public function getDocument() * * @return DOMNode|null */ + #[ReturnTypeWillChange] public function rewind() { $this->_position = 0; @@ -131,7 +132,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { if (in_array($this->_position, range(0, $this->_nodeList->length - 1)) && $this->_nodeList->length > 0) { return true; @@ -142,9 +143,9 @@ public function valid() /** * Iterator: return current element * - * @return DOMElement + * @return DOMElement|null */ - public function current() + public function current(): ?DOMElement { return $this->_nodeList->item($this->_position); } @@ -154,7 +155,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->_position; } @@ -164,6 +165,7 @@ public function key() * * @return DOMNode|null */ + #[ReturnTypeWillChange] public function next() { ++$this->_position; @@ -175,7 +177,7 @@ public function next() * * @return int */ - public function count() + public function count(): int { return $this->_nodeList->length; } diff --git a/library/Zend/EventManager/ResponseCollection.php b/library/Zend/EventManager/ResponseCollection.php index 6ef9d9aa18..fae00ea29a 100644 --- a/library/Zend/EventManager/ResponseCollection.php +++ b/library/Zend/EventManager/ResponseCollection.php @@ -100,7 +100,7 @@ public function bottom() * * @return int */ - public function count() + public function count(): int { return $this->count; } @@ -110,7 +110,7 @@ public function count() * * @return mixed */ - public function current() + public function current(): mixed { if (!$this->stack) { $this->rewind(); @@ -141,9 +141,9 @@ public function isEmpty() /** * Iterator: return key of current item in the stack * - * @return mixed + * @return string|int|null */ - public function key() + public function key(): string|int|null { if (!$this->stack) { $this->rewind(); @@ -156,6 +156,7 @@ public function key() * * @return void */ + #[ReturnTypeWillChange] public function next() { if (!$this->stack) { @@ -170,7 +171,7 @@ public function next() * @param mixed $index * @return bool */ - public function offsetExists($index) + public function offsetExists($index): bool { return array_key_exists($index, $this->data); } @@ -182,7 +183,7 @@ public function offsetExists($index) * @return mixed * @throws OutOfRangeException */ - public function offsetGet($index) + public function offsetGet($index): mixed { if (!$this->offsetExists($index)) { throw OutOfRangeException(sprintf('Invalid index ("%s") specified', $index)); @@ -197,7 +198,7 @@ public function offsetGet($index) * @param mixed $newval * @return void */ - public function offsetSet($index, $newval) + public function offsetSet($index, $newval): void { $this->data[$index] = $newval; $this->stack = false; @@ -211,7 +212,7 @@ public function offsetSet($index, $newval) * @return void * @throws OutOfRangeException */ - public function offsetUnset($index) + public function offsetUnset($index): void { if (!$this->offsetExists($index)) { throw OutOfRangeException(sprintf('Invalid index ("%s") specified', $index)); @@ -263,10 +264,10 @@ public function push($value) * * @return void */ - public function rewind() + public function rewind(): void { if (is_array($this->stack)) { - return reset($this->stack); + reset($this->stack); } $this->stack = array_reverse($this->data, true); } @@ -338,7 +339,7 @@ public function unshift($value) * * @return bool */ - public function valid() + public function valid(): bool { $key = key($this->stack); $var = ($key !== null && $key !== false); diff --git a/library/Zend/Feed.php b/library/Zend/Feed.php index 3eeed7406e..25c0a02566 100644 --- a/library/Zend/Feed.php +++ b/library/Zend/Feed.php @@ -257,15 +257,14 @@ public static function importString($string) */ public static function importFile($filename) { - @ini_set('track_errors', 1); $feed = @file_get_contents($filename); - @ini_restore('track_errors'); if ($feed === false) { /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); + $message = error_get_last()['message'] ?? 'Unknown error'; + throw new Zend_Feed_Exception("File could not be loaded: $message"); } return self::importString($feed); } @@ -297,16 +296,15 @@ public static function findFeeds($uri) $contents = $response->getBody(); // Parse the contents for appropriate tags - @ini_set('track_errors', 1); $pattern = '~(]+)/?>~i'; $result = @preg_match_all($pattern, $contents, $matches); - @ini_restore('track_errors'); if ($result === false) { /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("Internal error: $php_errormsg"); + $message = error_get_last()['message'] ?? 'Unknown error'; + throw new Zend_Feed_Exception("Internal error: $message"); } // Try to fetch a feed for each link tag that appears to refer to a feed diff --git a/library/Zend/Feed/Abstract.php b/library/Zend/Feed/Abstract.php index 287a65b793..594ce8a4e2 100644 --- a/library/Zend/Feed/Abstract.php +++ b/library/Zend/Feed/Abstract.php @@ -111,18 +111,17 @@ public function __construct($uri = null, $string = null, Zend_Feed_Builder_Inter */ public function __wakeup() { - @ini_set('track_errors', 1); $doc = new DOMDocument; $doc = @Zend_Xml_Security::scan($this->_element, $doc); - @ini_restore('track_errors'); if (!$doc) { // prevent the class to generate an undefined variable notice (ZF-2590) - if (!isset($php_errormsg)) { + $message = error_get_last()['message'] ?? null; + if (null === $message) { if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; + $message = '(error message not available, when XDebug is running)'; } else { - $php_errormsg = '(error message not available)'; + $message = '(error message not available)'; } } @@ -130,7 +129,7 @@ public function __wakeup() * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $message"); } $this->_element = $doc; @@ -172,7 +171,7 @@ protected function _buildEntryCache() * * @return integer Entry count. */ - public function count() + public function count(): int { return count($this->_entries); } @@ -183,7 +182,7 @@ public function count() * * @return void */ - public function rewind() + public function rewind(): void { $this->_entryIndex = 0; } @@ -194,7 +193,7 @@ public function rewind() * * @return mixed The current row, or null if no rows. */ - public function current() + public function current(): mixed { return new $this->_entryClassName( null, @@ -207,7 +206,7 @@ public function current() * * @return mixed The current row number (starts at 0), or NULL if no rows */ - public function key() + public function key(): mixed { return $this->_entryIndex; } @@ -218,7 +217,7 @@ public function key() * * @return mixed The next row, or null if no more rows. */ - public function next() + public function next(): void { ++$this->_entryIndex; } @@ -229,7 +228,7 @@ public function next() * * @return boolean Whether the iteration is valid */ - public function valid() + public function valid(): bool { return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); } diff --git a/library/Zend/Feed/Element.php b/library/Zend/Feed/Element.php index 6e8ffde88b..741efa98e1 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(fn ($e) => 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 @@ -369,7 +369,7 @@ protected function _children($var) * @param string $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); @@ -386,7 +386,7 @@ public function offsetExists($offset) * @param string $offset * @return string */ - public function offsetGet($offset) + public function offsetGet($offset): string { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); @@ -404,16 +404,16 @@ public function offsetGet($offset) * @param string $value * @return string */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->ensureAppended(); if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); // DOMElement::setAttributeNS() requires $qualifiedName to have a prefix - return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $offset, $value); + $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $offset, $value); } else { - return $this->_element->setAttribute($offset, $value); + $this->_element->setAttribute($offset, $value); } } @@ -424,6 +424,7 @@ public function offsetSet($offset, $value) * @param string $offset * @return boolean */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { if (strpos($offset, ':') !== false) { diff --git a/library/Zend/Feed/Entry/Abstract.php b/library/Zend/Feed/Entry/Abstract.php index 4601805c0e..38dc4277b6 100644 --- a/library/Zend/Feed/Entry/Abstract.php +++ b/library/Zend/Feed/Entry/Abstract.php @@ -80,18 +80,17 @@ public function __construct($uri = null, $element = null) if (!($element instanceof DOMElement)) { if ($element) { // Load the feed as an XML DOMDocument object - @ini_set('track_errors', 1); $doc = new DOMDocument(); $doc = @Zend_Xml_Security::scan($element, $doc); - @ini_restore('track_errors'); if (!$doc) { // prevent the class to generate an undefined variable notice (ZF-2590) - if (!isset($php_errormsg)) { + $message = error_get_last()['message'] ?? null; + if (null === $message) { if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; + $message = '(error message not available, when XDebug is running)'; } else { - $php_errormsg = '(error message not available)'; + $message = '(error message not available)'; } } @@ -99,7 +98,7 @@ public function __construct($uri = null, $element = null) * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $message"); } $element = $doc->getElementsByTagName($this->_rootElement)->item(0); diff --git a/library/Zend/Feed/Entry/Atom.php b/library/Zend/Feed/Entry/Atom.php index 83fd8f1d06..9aba1c0845 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: /** @@ -194,18 +194,17 @@ public function save($postUri = null) } // Update internal properties using $client->responseBody; - @ini_set('track_errors', 1); $newEntry = new DOMDocument; $newEntry = @Zend_Xml_Security::scan($response->getBody(), $newEntry); - @ini_restore('track_errors'); if (!$newEntry) { // prevent the class to generate an undefined variable notice (ZF-2590) - if (!isset($php_errormsg)) { + $message = error_get_last()['message'] ?? null; + if (null === $message) { if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; + $message = '(error message not available, when XDebug is running)'; } else { - $php_errormsg = '(error message not available)'; + $message = '(error message not available)'; } } @@ -213,7 +212,7 @@ public function save($postUri = null) * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg); + throw new Zend_Feed_Exception('XML cannot be parsed: ' . $message); } $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); diff --git a/library/Zend/Feed/Reader.php b/library/Zend/Feed/Reader.php index 92edc9a785..be1dfb34ac 100644 --- a/library/Zend/Feed/Reader.php +++ b/library/Zend/Feed/Reader.php @@ -388,15 +388,14 @@ public static function importString($string) */ public static function importFile($filename) { - @ini_set('track_errors', 1); $feed = @file_get_contents($filename); - @ini_restore('track_errors'); if ($feed === false) { /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); + $message = error_get_last()['message'] ?? 'Unknown error'; + throw new Zend_Feed_Exception("File could not be loaded: $message"); } return self::importString($feed); } @@ -416,10 +415,14 @@ public static function findFeedLinks($uri) } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); - $oldValue = libxml_disable_entity_loader(true); + if (\LIBXML_VERSION < 20900) { + $oldValue = libxml_disable_entity_loader(true); + } $dom = new DOMDocument; $status = $dom->loadHTML($responseHtml); - libxml_disable_entity_loader($oldValue); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader($oldValue); + } libxml_use_internal_errors($libxml_errflag); if (!$status) { // Build error message @@ -454,8 +457,9 @@ public static function detectType($feed, $specOnly = false) } elseif($feed instanceof DOMDocument) { $dom = $feed; } elseif(is_string($feed) && !empty($feed)) { - @ini_set('track_errors', 1); - //$oldValue = libxml_disable_entity_loader(true); + if (\LIBXML_VERSION < 20900) { + $oldValue = libxml_disable_entity_loader(true); + } $dom = new DOMDocument; try { $dom = Zend_Xml_Security::scan($feed, $dom); @@ -465,18 +469,20 @@ public static function detectType($feed, $specOnly = false) $e->getMessage() ); } - //libxml_disable_entity_loader($oldValue); - @ini_restore('track_errors'); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader($oldValue); + } if (!$dom) { - if (!isset($php_errormsg)) { + $message = error_get_last()['message'] ?? null; + if (null === $message) { if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; + $message = '(error message not available, when XDebug is running)'; } else { - $php_errormsg = '(error message not available)'; + $message = '(error message not available)'; } } require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $message"); } } else { require_once 'Zend/Feed/Exception.php'; diff --git a/library/Zend/Feed/Reader/Feed/Atom/Source.php b/library/Zend/Feed/Reader/Feed/Atom/Source.php index 744d3f33b1..1e67a3c809 100644 --- a/library/Zend/Feed/Reader/Feed/Atom/Source.php +++ b/library/Zend/Feed/Reader/Feed/Atom/Source.php @@ -67,32 +67,32 @@ public function __construct(DOMElement $source, $xpathPrefix, $type = Zend_Feed_ /** * @return void */ - public function count() {} + public function count(): int {} /** - * @return void + * @return Zend_Feed_Reader_EntryInterface */ - public function current() {} + public function current(): Zend_Feed_Reader_EntryInterface {} /** * @return void */ - public function key() {} + public function key(): mixed {} /** * @return void */ - public function next() {} + public function next(): void {} /** * @return void */ - public function rewind() {} + public function rewind(): void {} /** * @return void */ - public function valid() {} + public function valid(): bool {} /** * @return void diff --git a/library/Zend/Feed/Reader/FeedAbstract.php b/library/Zend/Feed/Reader/FeedAbstract.php index 3426958fba..b1e5fb0d35 100644 --- a/library/Zend/Feed/Reader/FeedAbstract.php +++ b/library/Zend/Feed/Reader/FeedAbstract.php @@ -136,7 +136,7 @@ public function getOriginalSourceUri() * * @return int */ - public function count() + public function count(): int { return count($this->_entries); } @@ -146,7 +146,7 @@ public function count() * * @return Zend_Feed_Reader_EntryInterface */ - public function current() + public function current(): Zend_Feed_Reader_EntryInterface { if (substr($this->getType(), 0, 3) == 'rss') { $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); @@ -226,9 +226,9 @@ public function getType() /** * Return the current feed key * - * @return unknown + * @return mixed */ - public function key() + public function key(): mixed { return $this->_entriesKey; } @@ -237,7 +237,7 @@ public function key() * Move the feed pointer forward * */ - public function next() + public function next(): void { ++$this->_entriesKey; } @@ -246,7 +246,7 @@ public function next() * Reset the pointer in the feed object * */ - public function rewind() + public function rewind(): void { $this->_entriesKey = 0; } @@ -256,7 +256,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); } diff --git a/library/Zend/Feed/Reader/FeedSet.php b/library/Zend/Feed/Reader/FeedSet.php index 962ea765ee..b6fe689399 100644 --- a/library/Zend/Feed/Reader/FeedSet.php +++ b/library/Zend/Feed/Reader/FeedSet.php @@ -132,7 +132,7 @@ protected function _canonicalizePath($path) * @return mixed * @uses Zend_Feed_Reader */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { if ($offset == 'feed' && !$this->offsetExists('feed')) { if (!$this->offsetExists('href')) { diff --git a/library/Zend/Feed/Writer/Feed.php b/library/Zend/Feed/Writer/Feed.php index c0c13636bf..b76bc8d9ac 100644 --- a/library/Zend/Feed/Writer/Feed.php +++ b/library/Zend/Feed/Writer/Feed.php @@ -200,7 +200,7 @@ public function orderByDate() * * @return int */ - public function count() + public function count(): int { return count($this->_entries); } @@ -208,9 +208,9 @@ public function count() /** * Return the current entry * - * @return Zend_Feed_Reader_Entry_Interface + * @return Zend_Feed_Reader_EntryInterface|null */ - public function current() + public function current(): ?Zend_Feed_Reader_EntryInterface { return $this->_entries[$this->key()]; } @@ -218,9 +218,9 @@ public function current() /** * Return the current feed key * - * @return unknown + * @return mixed */ - public function key() + public function key(): mixed { return $this->_entriesKey; } @@ -230,7 +230,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { ++$this->_entriesKey; } @@ -240,7 +240,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_entriesKey = 0; } @@ -250,7 +250,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); } diff --git a/library/Zend/File/ClassFileLocator.php b/library/Zend/File/ClassFileLocator.php index 3dee60358f..ff491ca03b 100644 --- a/library/Zend/File/ClassFileLocator.php +++ b/library/Zend/File/ClassFileLocator.php @@ -75,7 +75,7 @@ public function __construct($dirOrIterator = '.') * * @return bool */ - public function accept() + public function accept(): bool { $file = $this->getInnerIterator()->current(); // If we somehow have something other than an SplFileInfo object, just 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/Form.php b/library/Zend/Form.php index 0512dc850b..8632821e25 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): @@ -1687,7 +1687,7 @@ public function addSubForms(array $subForms) $order = null; switch ($argc) { case 0: - continue; + break; case (1 <= $argc): $subForm = array_shift($spec); @@ -2123,7 +2123,7 @@ protected function _getArrayName($value) protected function _dissolveArrayValue($value, $arrayPath) { // As long as we have more levels - while ($arrayPos = strpos($arrayPath, '[')) { + while ($arrayPos = strpos(strval($arrayPath), '[')) { // Get the next key in the path $arrayKey = trim(substr($arrayPath, 0, $arrayPos), ']'); @@ -2181,7 +2181,7 @@ protected function _dissolveArrayUnsetKey($array, $arrayPath, $key) protected function _attachToArray($value, $arrayPath) { // As long as we have more levels - while ($arrayPos = strrpos($arrayPath, '[')) { + while ($arrayPos = strrpos(strval($arrayPath), '[')) { // Get the next key in the path $arrayKey = trim(substr($arrayPath, $arrayPos + 1), ']'); @@ -3272,7 +3272,7 @@ public function __call($method, $args) * @throws Zend_Form_Exception * @return Zend_Form_Element|Zend_Form_DisplayGroup|Zend_Form */ - public function current() + public function current(): Zend_Form_Element|Zend_Form_DisplayGroup|Zend_Form { $this->_sort(); current($this->_order); @@ -3293,9 +3293,9 @@ public function current() /** * Current element/subform/display group name * - * @return string + * @return string|null */ - public function key() + public function key(): ?string { $this->_sort(); return key($this->_order); @@ -3306,7 +3306,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_sort(); next($this->_order); @@ -3317,7 +3317,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_sort(); reset($this->_order); @@ -3328,7 +3328,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $this->_sort(); return (current($this->_order) !== false); @@ -3339,7 +3339,7 @@ public function valid() * * @return int */ - public function count() + public function count(): int { return count($this->_order); } diff --git a/library/Zend/Form/Decorator/Description.php b/library/Zend/Form/Decorator/Description.php index e47b337db8..d2f0b23a24 100644 --- a/library/Zend/Form/Decorator/Description.php +++ b/library/Zend/Form/Decorator/Description.php @@ -159,7 +159,7 @@ public function render($content) } $description = $element->getDescription(); - $description = trim($description); + $description = trim(strval($description)); if (!empty($description) && (null !== ($translator = $element->getTranslator()))) { $description = $translator->translate($description); diff --git a/library/Zend/Form/Decorator/HtmlTag.php b/library/Zend/Form/Decorator/HtmlTag.php index 300fdc0e3f..3245af0977 100644 --- a/library/Zend/Form/Decorator/HtmlTag.php +++ b/library/Zend/Form/Decorator/HtmlTag.php @@ -92,7 +92,7 @@ protected function _htmlAttribs(array $attribs) $val = implode(' ', $val); } } - $val = htmlspecialchars($val, ENT_COMPAT, $enc); + $val = htmlspecialchars(strval($val), ENT_COMPAT, $enc); $xhtml .= " $key=\"$val\""; } return $xhtml; diff --git a/library/Zend/Form/Decorator/Label.php b/library/Zend/Form/Decorator/Label.php index d922f5bab9..e6062be393 100644 --- a/library/Zend/Form/Decorator/Label.php +++ b/library/Zend/Form/Decorator/Label.php @@ -302,7 +302,7 @@ public function getLabel() } $label = $element->getLabel(); - $label = trim($label); + $label = trim(strval($label)); if (empty($label)) { return ''; diff --git a/library/Zend/Form/DisplayGroup.php b/library/Zend/Form/DisplayGroup.php index a18f236437..bb82460eff 100644 --- a/library/Zend/Form/DisplayGroup.php +++ b/library/Zend/Form/DisplayGroup.php @@ -1044,9 +1044,9 @@ public function __call($method, $args) /** * Current element * - * @return Zend_Form_Element + * @return Zend_Form_Element|null */ - public function current() + public function current(): ?Zend_Form_Element { $this->_sort(); current($this->_elementOrder); @@ -1059,7 +1059,7 @@ public function current() * * @return string */ - public function key() + public function key(): ?string { $this->_sort(); return key($this->_elementOrder); @@ -1070,7 +1070,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_sort(); next($this->_elementOrder); @@ -1081,7 +1081,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_sort(); reset($this->_elementOrder); @@ -1092,7 +1092,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $this->_sort(); return (current($this->_elementOrder) !== false); @@ -1103,7 +1103,7 @@ public function valid() * * @return int */ - public function count() + public function count(): int { return count($this->_elements); } diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index 26bad9af3b..9277b92d44 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -40,6 +40,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ +#[AllowDynamicProperties] class Zend_Form_Element implements Zend_Validate_Interface { /** @@ -588,7 +589,7 @@ public function setValue($value) * @param string $key * @return void */ - protected function _filterValue(&$value, &$key) + protected function _filterValue(&$value, $key) { foreach ($this->getFilters() as $filter) { $value = $filter->filter($value); diff --git a/library/Zend/Gdata/App.php b/library/Zend/Gdata/App.php index 1508743d7f..f66f8288da 100644 --- a/library/Zend/Gdata/App.php +++ b/library/Zend/Gdata/App.php @@ -823,15 +823,14 @@ public static function importString($string, } // Load the feed as an XML DOMDocument object - @ini_set('track_errors', 1); $doc = new DOMDocument(); $doc = @Zend_Xml_Security::scan($string, $doc); - @ini_restore('track_errors'); if (!$doc) { require_once 'Zend/Gdata/App/Exception.php'; + $message = error_get_last()['message'] ?? 'Unknown error'; throw new Zend_Gdata_App_Exception( - "DOMDocument cannot parse XML: $php_errormsg"); + "DOMDocument cannot parse XML: $message"); } $feed = new $className(); @@ -855,13 +854,12 @@ public static function importString($string, public static function importFile($filename, $className='Zend_Gdata_App_Feed', $useIncludePath = false) { - @ini_set('track_errors', 1); $feed = @file_get_contents($filename, $useIncludePath); - @ini_restore('track_errors'); if ($feed === false) { require_once 'Zend/Gdata/App/Exception.php'; + $message = error_get_last()['message'] ?? 'Unknown error'; throw new Zend_Gdata_App_Exception( - "File could not be loaded: $php_errormsg"); + "File could not be loaded: $message"); } return self::importString($feed, $className); } @@ -1084,11 +1082,11 @@ public function __call($method, $args) } else { require_once 'Zend/Gdata/App/Exception.php'; throw new Zend_Gdata_App_Exception( - "Unable to find '${class}' in registered packages"); + "Unable to find '{$class}' in registered packages"); } } else { require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("No such method ${method}"); + throw new Zend_Gdata_App_Exception("No such method {$method}"); } } diff --git a/library/Zend/Gdata/App/Base.php b/library/Zend/Gdata/App/Base.php index 4635840370..1d2b3de9d5 100644 --- a/library/Zend/Gdata/App/Base.php +++ b/library/Zend/Gdata/App/Base.php @@ -302,13 +302,12 @@ public function transferFromXML($xml) { if ($xml) { // Load the feed as an XML DOMDocument object - @ini_set('track_errors', 1); $doc = new DOMDocument(); $doc = @Zend_Xml_Security::scan($xml, $doc); - @ini_restore('track_errors'); if (!$doc) { require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg"); + $message = error_get_last()['message'] ?? 'Unknown error'; + throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $message"); } $element = $doc->getElementsByTagName($this->_rootElement)->item(0); if (!$element) { @@ -480,7 +479,7 @@ public function __get($name) $method = 'get'.ucfirst($name); if (method_exists($this, $method)) { return call_user_func(array(&$this, $method)); - } else if (property_exists($this, "_${name}")) { + } else if (property_exists($this, "_{$name}")) { return $this->{'_' . $name}; } else { require_once 'Zend/Gdata/App/InvalidArgumentException.php'; diff --git a/library/Zend/Gdata/App/BaseMediaSource.php b/library/Zend/Gdata/App/BaseMediaSource.php index 7e136ac455..e015ed0225 100644 --- a/library/Zend/Gdata/App/BaseMediaSource.php +++ b/library/Zend/Gdata/App/BaseMediaSource.php @@ -113,7 +113,7 @@ public function __get($name) $method = 'get'.ucfirst($name); if (method_exists($this, $method)) { return call_user_func(array(&$this, $method)); - } else if (property_exists($this, "_${name}")) { + } else if (property_exists($this, "_{$name}")) { return $this->{'_' . $name}; } else { require_once 'Zend/Gdata/App/InvalidArgumentException.php'; diff --git a/library/Zend/Gdata/App/Feed.php b/library/Zend/Gdata/App/Feed.php index 2e07bd0bd4..ecd6da6b30 100755 --- a/library/Zend/Gdata/App/Feed.php +++ b/library/Zend/Gdata/App/Feed.php @@ -129,7 +129,7 @@ protected function takeChildFromDOM($child) * * @return integer Entry count. */ - public function count() + public function count(): int { return count($this->_entry); } @@ -139,7 +139,7 @@ public function count() * * @return void */ - public function rewind() + public function rewind(): void { $this->_entryIndex = 0; } @@ -149,7 +149,7 @@ public function rewind() * * @return mixed The current row, or null if no rows. */ - public function current() + public function current(): mixed { return $this->_entry[$this->_entryIndex]; } @@ -159,7 +159,7 @@ public function current() * * @return mixed The current row number (starts at 0), or NULL if no rows */ - public function key() + public function key(): mixed { return $this->_entryIndex; } @@ -169,7 +169,7 @@ public function key() * * @return mixed The next row, or null if no more rows. */ - public function next() + public function next(): void { ++$this->_entryIndex; } @@ -179,7 +179,7 @@ public function next() * * @return boolean Whether the iteration is valid */ - public function valid() + public function valid(): bool { return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); } @@ -228,7 +228,7 @@ public function addEntry($value) * @param Zend_Gdata_App_Entry $value The value to set * @return void */ - public function offsetSet($key, $value) + public function offsetSet($key, $value): void { $this->_entry[$key] = $value; } @@ -239,11 +239,12 @@ public function offsetSet($key, $value) * @param int $key The index to get * @param Zend_Gdata_App_Entry $value The value to set */ - public function offsetGet($key) + public function offsetGet($key): mixed { if (array_key_exists($key, $this->_entry)) { return $this->_entry[$key]; } + return null; } /** @@ -252,7 +253,7 @@ public function offsetGet($key) * @param int $key The index to set * @param Zend_Gdata_App_Entry $value The value to set */ - public function offsetUnset($key) + public function offsetUnset($key): void { if (array_key_exists($key, $this->_entry)) { unset($this->_entry[$key]); @@ -265,7 +266,7 @@ public function offsetUnset($key) * @param int $key The index to check for existence * @return boolean */ - public function offsetExists($key) + public function offsetExists($key): bool { return (array_key_exists($key, $this->_entry)); } diff --git a/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php b/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php index ee85da807f..91a7afceca 100644 --- a/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php +++ b/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php @@ -73,7 +73,7 @@ protected function log($message) */ public function connect($host, $port = 80, $secure = false) { - $this->log("Connecting to: ${host}:${port}"); + $this->log("Connecting to: {$host}:{$port}"); return parent::connect($host, $port, $secure); } @@ -102,7 +102,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod public function read() { $response = parent::read(); - $this->log("${response}\n\n"); + $this->log("{$response}\n\n"); return $response; } diff --git a/library/Zend/Gdata/Gapps.php b/library/Zend/Gdata/Gapps.php index 7f2924ef4f..5875c42d62 100644 --- a/library/Zend/Gdata/Gapps.php +++ b/library/Zend/Gdata/Gapps.php @@ -879,7 +879,7 @@ public function __call($method, $args) { } else { require_once 'Zend/Gdata/App/Exception.php'; throw new Zend_Gdata_App_Exception( - "Unable to find '${class}' in registered packages"); + "Unable to find '{$class}' in registered packages"); } } else { return parent::__call($method, $args); diff --git a/library/Zend/Gdata/Gapps/ServiceException.php b/library/Zend/Gdata/Gapps/ServiceException.php index 674ba4d156..7aa0c1945e 100644 --- a/library/Zend/Gdata/Gapps/ServiceException.php +++ b/library/Zend/Gdata/Gapps/ServiceException.php @@ -157,20 +157,13 @@ public function hasError($errorCode) { public function importFromString($string) { if ($string) { // Check to see if an AppsForYourDomainError exists - // - // track_errors is temporarily enabled so that if an error - // occurs while parsing the XML we can append it to an - // exception by referencing $php_errormsg - @ini_set('track_errors', 1); $doc = new DOMDocument(); $doc = @Zend_Xml_Security::scan($string, $doc); - @ini_restore('track_errors'); if (!$doc) { require_once 'Zend/Gdata/App/Exception.php'; - // $php_errormsg is automatically generated by PHP if - // an error occurs while calling loadXML(), above. - throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg"); + $message = error_get_last()['message'] ?? 'Unknown error'; + throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $message"); } // Ensure that the outermost node is an AppsForYourDomain error. diff --git a/library/Zend/Gdata/YouTube.php b/library/Zend/Gdata/YouTube.php index d49c16dd34..0871ad8d07 100644 --- a/library/Zend/Gdata/YouTube.php +++ b/library/Zend/Gdata/YouTube.php @@ -652,16 +652,15 @@ public function getUserProfile($user = null, $location = null) public static function parseFormUploadTokenResponse($response) { // Load the feed as an XML DOMDocument object - @ini_set('track_errors', 1); $doc = new DOMDocument(); $doc = @Zend_Xml_Security::scan($response, $doc); - @ini_restore('track_errors'); if (!$doc) { require_once 'Zend/Gdata/App/Exception.php'; + $message = error_get_last()['message'] ?? 'Unknown error'; throw new Zend_Gdata_App_Exception( "Zend_Gdata_YouTube::parseFormUploadTokenResponse - " . - "DOMDocument cannot parse XML: $php_errormsg"); + "DOMDocument cannot parse XML: $message"); } $responseElement = $doc->getElementsByTagName('response')->item(0); @@ -799,8 +798,8 @@ public function getInboxFeedForCurrentUser() * Zend_Gdata_YouTube_Inbox_Entry representing the sent message. * */ - public function sendVideoMessage($body, $videoEntry = null, - $videoId = null, $recipientUserName) + public function sendVideoMessage($body, $videoEntry, + $videoId, $recipientUserName) { if (!$videoId && !$videoEntry) { require_once 'Zend/Gdata/App/InvalidArgumentException.php'; diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index b704249cc2..87d37388d1 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -277,6 +277,8 @@ class Zend_Http_Client */ protected static $_fileInfoDb = null; + private $_stream_name = false; + /** * Constructor method. Will create a new HTTP client. Accepts the target * URL and optionally configuration array. diff --git a/library/Zend/Http/CookieJar.php b/library/Zend/Http/CookieJar.php index a76d1fcf10..96462f1b86 100644 --- a/library/Zend/Http/CookieJar.php +++ b/library/Zend/Http/CookieJar.php @@ -390,7 +390,7 @@ public static function fromResponse(Zend_Http_Response $response, $ref_uri) * * @return int */ - public function count() + public function count(): int { return count($this->_rawCookies); } @@ -400,7 +400,7 @@ public function count() * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): ArrayIterator { return new ArrayIterator($this->_rawCookies); } diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php index af3e2dbb19..3e6c8ebdaa 100644 --- a/library/Zend/Http/Response.php +++ b/library/Zend/Http/Response.php @@ -182,7 +182,7 @@ public function __construct($code, array $headers, $body = null, $version = '1.1 $this->body = $body; // Set the HTTP version - if (! preg_match('|^\d\.\d$|', $version)) { + if (! preg_match('|^\d+(?:\.\d+)?$|', $version)) { require_once 'Zend/Http/Exception.php'; throw new Zend_Http_Exception("Invalid HTTP response version: $version"); } @@ -260,7 +260,7 @@ public function getBody() $body = ''; // Decode the body if it was transfer-encoded - switch (strtolower($this->getHeader('transfer-encoding'))) { + switch (strtolower($this->getHeader('transfer-encoding') ?? '')) { // Handle chunked body case 'chunked': @@ -275,7 +275,7 @@ public function getBody() } // Decode any content-encoding (gzip or deflate) if needed - switch (strtolower($this->getHeader('content-encoding'))) { + switch (strtolower($this->getHeader('content-encoding') ?? '')) { // Handle gzip encoding case 'gzip': @@ -514,7 +514,7 @@ public static function extractHeaders($response_str) $last_header = null; foreach($lines as $index => $line) { - if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+) [1-5]\d+#', $line)) { + if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+)? [1-5]\d+#', $line)) { // Status line; ignore continue; } diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index 8a79f0cdd2..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 @@ -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/Ldap/Collection.php b/library/Zend/Ldap/Collection.php index f23c4cebc4..3ff58ef1d0 100644 --- a/library/Zend/Ldap/Collection.php +++ b/library/Zend/Ldap/Collection.php @@ -120,7 +120,7 @@ public function getInnerIterator() * * @return int */ - public function count() + public function count(): int { return $this->_iterator->count(); } @@ -132,7 +132,7 @@ public function count() * @return array|null * @throws Zend_Ldap_Exception */ - public function current() + public function current(): mixed { if ($this->count() > 0) { if ($this->_current < 0) { @@ -185,7 +185,7 @@ public function dn() * * @return int|null */ - public function key() + public function key(): mixed { if ($this->count() > 0) { if ($this->_current < 0) { @@ -203,7 +203,7 @@ public function key() * * @throws Zend_Ldap_Exception */ - public function next() + public function next(): void { $this->_iterator->next(); $this->_current++; @@ -215,7 +215,7 @@ public function next() * * @throws Zend_Ldap_Exception */ - public function rewind() + public function rewind(): void { $this->_iterator->rewind(); $this->_current = 0; @@ -228,7 +228,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { if (isset($this->_cache[$this->_current])) { return true; diff --git a/library/Zend/Ldap/Collection/Iterator/Default.php b/library/Zend/Ldap/Collection/Iterator/Default.php index d1d44fb66e..d67bbd0289 100644 --- a/library/Zend/Ldap/Collection/Iterator/Default.php +++ b/library/Zend/Ldap/Collection/Iterator/Default.php @@ -177,7 +177,7 @@ public function getAttributeNameTreatment() * * @return int */ - public function count() + public function count(): int { return $this->_itemCount; } @@ -189,7 +189,7 @@ public function count() * @return array|null * @throws Zend_Ldap_Exception */ - public function current() + public function current(): mixed { if (!is_resource($this->_current)) { $this->rewind(); @@ -234,7 +234,7 @@ public function current() * * @return string|null */ - public function key() + public function key(): string|null { if (!is_resource($this->_current)) { $this->rewind(); @@ -258,7 +258,7 @@ public function key() * * @throws Zend_Ldap_Exception */ - public function next() + public function next(): void { if (is_resource($this->_current) && $this->_itemCount > 0) { $this->_current = @ldap_next_entry($this->_ldap->getResource(), $this->_current); @@ -284,7 +284,7 @@ public function next() * * @throws Zend_Ldap_Exception */ - public function rewind() + public function rewind(): void { if (is_resource($this->_resultId)) { $this->_current = @ldap_first_entry($this->_ldap->getResource(), $this->_resultId); @@ -304,7 +304,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return (is_resource($this->_current)); } diff --git a/library/Zend/Ldap/Dn.php b/library/Zend/Ldap/Dn.php index 7f7e8e3d38..4e235787d1 100644 --- a/library/Zend/Ldap/Dn.php +++ b/library/Zend/Ldap/Dn.php @@ -417,7 +417,7 @@ public function __toString() * @param int $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { $offset = (int)$offset; if ($offset < 0 || $offset >= count($this->_dn)) { @@ -434,7 +434,7 @@ public function offsetExists($offset) * @param int $offset * @return array */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->get($offset, 1, null); } @@ -446,7 +446,7 @@ public function offsetGet($offset) * @param int $offset * @param array $value */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->set($offset, $value); } @@ -457,7 +457,7 @@ public function offsetSet($offset, $value) * * @param int $offset */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { $this->remove($offset, 1); } diff --git a/library/Zend/Ldap/Node.php b/library/Zend/Ldap/Node.php index f718cc1676..243512122c 100644 --- a/library/Zend/Ldap/Node.php +++ b/library/Zend/Ldap/Node.php @@ -874,7 +874,7 @@ public function __unset($name) * @return null * @throws Zend_Ldap_Exception */ - public function offsetSet($name, $value) + public function offsetSet($name, $value): void { $this->setAttribute($name, $value); } @@ -891,7 +891,7 @@ public function offsetSet($name, $value) * @return null * @throws Zend_Ldap_Exception */ - public function offsetUnset($name) + public function offsetUnset($name): void { $this->deleteAttribute($name); } @@ -1027,7 +1027,7 @@ public function hasChildren() * @return Zend_Ldap_Node_ChildrenIterator * @throws Zend_Ldap_Exception */ - public function getChildren() + public function getChildren(): Zend_Ldap_Node_ChildrenIterator { if (!is_array($this->_children)) { $this->_children = array(); @@ -1067,9 +1067,9 @@ public function getParent(Zend_Ldap $ldap = null) * Return the current attribute. * Implements Iterator * - * @return array + * @return static */ - public function current() + public function current(): static { return $this; } @@ -1080,7 +1080,7 @@ public function current() * * @return string */ - public function key() + public function key(): string { return $this->getRdnString(); } @@ -1089,7 +1089,7 @@ public function key() * Move forward to next attribute. * Implements Iterator */ - public function next() + public function next(): void { $this->_iteratorRewind = false; } @@ -1098,7 +1098,7 @@ public function next() * Rewind the Iterator to the first attribute. * Implements Iterator */ - public function rewind() + public function rewind(): void { $this->_iteratorRewind = true; } @@ -1110,7 +1110,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return $this->_iteratorRewind; } diff --git a/library/Zend/Ldap/Node/Abstract.php b/library/Zend/Ldap/Node/Abstract.php index febc549bf2..6c80b19623 100644 --- a/library/Zend/Ldap/Node/Abstract.php +++ b/library/Zend/Ldap/Node/Abstract.php @@ -421,7 +421,7 @@ public function __isset($name) * @return null * @throws BadMethodCallException */ - public function offsetSet($name, $value) + public function offsetSet($name, $value): void { throw new BadMethodCallException(); } @@ -436,7 +436,7 @@ public function offsetSet($name, $value) * @return array * @throws Zend_Ldap_Exception */ - public function offsetGet($name) + public function offsetGet($name): mixed { return $this->getAttribute($name, null); } @@ -453,7 +453,7 @@ public function offsetGet($name) * @return null * @throws BadMethodCallException */ - public function offsetUnset($name) + public function offsetUnset($name): void { throw new BadMethodCallException(); } @@ -467,7 +467,7 @@ public function offsetUnset($name) * @param string $name * @return boolean */ - public function offsetExists($name) + public function offsetExists($name): bool { return $this->existsAttribute($name, false); } @@ -478,7 +478,7 @@ public function offsetExists($name) * * @return int */ - public function count() + public function count(): int { return count($this->_currentData); } diff --git a/library/Zend/Ldap/Node/ChildrenIterator.php b/library/Zend/Ldap/Node/ChildrenIterator.php index 6b044ef4b6..0dbab3216c 100644 --- a/library/Zend/Ldap/Node/ChildrenIterator.php +++ b/library/Zend/Ldap/Node/ChildrenIterator.php @@ -60,7 +60,7 @@ public function __construct(array $data) * * @return int */ - public function count() + public function count(): int { return count($this->_data); } @@ -71,7 +71,7 @@ public function count() * * @return Zend_Ldap_Node */ - public function current() + public function current(): mixed { return current($this->_data); } @@ -80,9 +80,9 @@ public function current() * Return the child'd RDN. * Implements Iterator * - * @return string + * @return string|null */ - public function key() + public function key(): ?string { return key($this->_data); } @@ -91,7 +91,7 @@ public function key() * Move forward to next child. * Implements Iterator */ - public function next() + public function next(): void { next($this->_data); } @@ -100,7 +100,7 @@ public function next() * Rewind the Iterator to the first child. * Implements Iterator */ - public function rewind() + public function rewind(): void { reset($this->_data); } @@ -112,7 +112,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return (current($this->_data)!==false); } @@ -135,9 +135,9 @@ public function hasChildren() /** * Returns the children for the current node. * - * @return Zend_Ldap_Node_ChildrenIterator + * @return Zend_Ldap_Node_ChildrenIterator|null */ - public function getChildren() + public function getChildren(): ?Zend_Ldap_Node_ChildrenIterator { if ($this->current() instanceof Zend_Ldap_Node) { return $this->current()->getChildren(); @@ -151,9 +151,9 @@ public function getChildren() * Implements ArrayAccess. * * @param string $rdn - * @return Zend_Ldap_node + * @return Zend_Ldap_Node|null */ - public function offsetGet($rdn) + public function offsetGet($rdn): ?Zend_Ldap_Node { if ($this->offsetExists($rdn)) { return $this->_data[$rdn]; @@ -169,7 +169,7 @@ public function offsetGet($rdn) * @param string $rdn * @return boolean */ - public function offsetExists($rdn) + public function offsetExists($rdn): bool { return (array_key_exists($rdn, $this->_data)); } @@ -181,7 +181,7 @@ public function offsetExists($rdn) * @param string $name * @return null */ - public function offsetUnset($name) { } + public function offsetUnset($name): void { } /** * Does nothing. @@ -191,7 +191,7 @@ public function offsetUnset($name) { } * @param mixed $value * @return null */ - public function offsetSet($name, $value) { } + public function offsetSet($name, $value): void { } /** * Get all children as an array diff --git a/library/Zend/Ldap/Node/Collection.php b/library/Zend/Ldap/Node/Collection.php index d04f99b153..42fa1236c7 100644 --- a/library/Zend/Ldap/Node/Collection.php +++ b/library/Zend/Ldap/Node/Collection.php @@ -58,9 +58,9 @@ protected function _createEntry(array $data) * Return the child key (DN). * Implements Iterator and RecursiveIterator * - * @return string + * @return string|null */ - public function key() + public function key(): string|null { return $this->_iterator->key(); } diff --git a/library/Zend/Ldap/Node/Schema/Item.php b/library/Zend/Ldap/Node/Schema/Item.php index 4404f1dcbd..e65e9071ea 100644 --- a/library/Zend/Ldap/Node/Schema/Item.php +++ b/library/Zend/Ldap/Node/Schema/Item.php @@ -108,7 +108,7 @@ public function __isset($name) * @return null * @throws BadMethodCallException */ - public function offsetSet($name, $value) + public function offsetSet($name, $value): void { throw new BadMethodCallException(); } @@ -119,7 +119,7 @@ public function offsetSet($name, $value) * @param string $name * @return mixed */ - public function offsetGet($name) + public function offsetGet($name): mixed { return $this->__get($name); } @@ -134,7 +134,7 @@ public function offsetGet($name) * @return null * @throws BadMethodCallException */ - public function offsetUnset($name) + public function offsetUnset($name): void { throw new BadMethodCallException(); } @@ -145,7 +145,7 @@ public function offsetUnset($name) * @param string $name * @return boolean */ - public function offsetExists($name) + public function offsetExists($name): bool { return $this->__isset($name); } @@ -156,7 +156,7 @@ public function offsetExists($name) * * @return int */ - public function count() + public function count(): int { return count($this->_data); } diff --git a/library/Zend/Mail.php b/library/Zend/Mail.php index 5a6b57fa58..87a259a9d3 100644 --- a/library/Zend/Mail.php +++ b/library/Zend/Mail.php @@ -1248,7 +1248,7 @@ protected function _filterOther($data) "\t" => '', ); - return strtr($data, $rule); + return trim(strtr(strval($name), $rule)); } /** diff --git a/library/Zend/Mail/Part.php b/library/Zend/Mail/Part.php index ca881a791e..3775ed1b95 100644 --- a/library/Zend/Mail/Part.php +++ b/library/Zend/Mail/Part.php @@ -520,7 +520,7 @@ public function hasChildren() * * @return Zend_Mail_Part same as self::current() */ - public function getChildren() + public function getChildren(): Zend_Mail_Part { return $this->current(); } @@ -530,7 +530,7 @@ public function getChildren() * * @return bool check if there's a current element */ - public function valid() + public function valid(): bool { if ($this->_countParts === null) { $this->countParts(); @@ -543,7 +543,7 @@ public function valid() * * @return null */ - public function next() + public function next(): void { ++$this->_iterationPos; } @@ -553,7 +553,7 @@ public function next() * * @return string key/number of current part */ - public function key() + public function key(): mixed { return $this->_iterationPos; } @@ -563,7 +563,7 @@ public function key() * * @return Zend_Mail_Part current part */ - public function current() + public function current(): Zend_Mail_Part { return $this->getPart($this->_iterationPos); } @@ -571,9 +571,9 @@ public function current() /** * implements Iterator::rewind() * - * @return null + * @return void */ - public function rewind() + public function rewind(): void { $this->countParts(); $this->_iterationPos = 1; diff --git a/library/Zend/Mail/Storage/Abstract.php b/library/Zend/Mail/Storage/Abstract.php index beb8fb6fb7..f4f5381d29 100644 --- a/library/Zend/Mail/Storage/Abstract.php +++ b/library/Zend/Mail/Storage/Abstract.php @@ -215,7 +215,7 @@ abstract public function getNumberByUniqueId($id); * * @return int */ - public function count() + public function count(): int { return $this->countMessages(); } @@ -227,7 +227,7 @@ public function count() * @param int $id * @return boolean */ - public function offsetExists($id) + public function offsetExists($id): bool { try { if ($this->getMessage($id)) { @@ -245,7 +245,7 @@ public function offsetExists($id) * @param int $id * @return Zend_Mail_Message message object */ - public function offsetGet($id) + public function offsetGet($id): Zend_Mail_Message { return $this->getMessage($id); } @@ -259,7 +259,7 @@ public function offsetGet($id) * @throws Zend_Mail_Storage_Exception * @return void */ - public function offsetSet($id, $value) + public function offsetSet($id, $value): void { /** * @see Zend_Mail_Storage_Exception @@ -275,6 +275,7 @@ public function offsetSet($id, $value) * @param int $id * @return boolean success */ + #[ReturnTypeWillChange] public function offsetUnset($id) { return $this->removeMessage($id); @@ -290,7 +291,7 @@ public function offsetUnset($id) * * @return void */ - public function rewind() + public function rewind(): void { $this->_iterationMax = $this->countMessages(); $this->_iterationPos = 1; @@ -302,7 +303,7 @@ public function rewind() * * @return Zend_Mail_Message current message */ - public function current() + public function current(): Zend_Mail_Message { return $this->getMessage($this->_iterationPos); } @@ -313,7 +314,7 @@ public function current() * * @return int id of current position */ - public function key() + public function key(): int { return $this->_iterationPos; } @@ -324,7 +325,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { ++$this->_iterationPos; } @@ -335,7 +336,7 @@ public function next() * * @return boolean */ - public function valid() + public function valid(): bool { if ($this->_iterationMax === null) { $this->_iterationMax = $this->countMessages(); diff --git a/library/Zend/Mail/Storage/Folder.php b/library/Zend/Mail/Storage/Folder.php index 191dbca203..7cbc3dbf96 100644 --- a/library/Zend/Mail/Storage/Folder.php +++ b/library/Zend/Mail/Storage/Folder.php @@ -86,7 +86,7 @@ public function hasChildren() * * @return Zend_Mail_Storage_Folder same as self::current() */ - public function getChildren() + public function getChildren(): Zend_Mail_Storage_Folder { return $this->current(); } @@ -96,7 +96,7 @@ public function getChildren() * * @return bool check if there's a current element */ - public function valid() + public function valid(): bool { return key($this->_folders) !== null; } @@ -106,7 +106,7 @@ public function valid() * * @return null */ - public function next() + public function next(): void { next($this->_folders); } @@ -114,9 +114,9 @@ public function next() /** * implements Iterator::key() * - * @return string key/local name of current element + * @return string|null key/local name of current element */ - public function key() + public function key(): ?string { return key($this->_folders); } @@ -124,9 +124,9 @@ public function key() /** * implements Iterator::current() * - * @return Zend_Mail_Storage_Folder current folder + * @return Zend_Mail_Storage_Folder|false current folder */ - public function current() + public function current(): Zend_Mail_Storage_Folder|false { return current($this->_folders); } @@ -136,7 +136,7 @@ public function current() * * @return null */ - public function rewind() + public function rewind(): void { reset($this->_folders); } diff --git a/library/Zend/Markup/TokenList.php b/library/Zend/Markup/TokenList.php index cbfc78a76c..52119d5fc7 100644 --- a/library/Zend/Markup/TokenList.php +++ b/library/Zend/Markup/TokenList.php @@ -43,9 +43,9 @@ class Zend_Markup_TokenList implements RecursiveIterator /** * Get the current token * - * @return Zend_Markup_Token + * @return Zend_Markup_Token|false */ - public function current() + public function current(): Zend_Markup_Token|false { return current($this->_tokens); } @@ -55,7 +55,7 @@ public function current() * * @return Zend_Markup_TokenList */ - public function getChildren() + public function getChildren(): Zend_Markup_TokenList { return current($this->_tokens)->getChildren(); } @@ -85,9 +85,9 @@ public function hasChildren() /** * Get the key of the current token * - * @return int + * @return int|null */ - public function key() + public function key(): ?int { return key($this->_tokens); } @@ -97,6 +97,7 @@ public function key() * * @return Zend_Markup_Token */ + #[ReturnTypeWillChange] public function next() { return next($this->_tokens); @@ -107,7 +108,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { reset($this->_tokens); } @@ -117,7 +118,7 @@ public function rewind() * * @return void */ - public function valid() + public function valid(): bool { return $this->current() !== false; } diff --git a/library/Zend/Memory/Value.php b/library/Zend/Memory/Value.php index 99950fb5b0..ccc4af9fea 100644 --- a/library/Zend/Memory/Value.php +++ b/library/Zend/Memory/Value.php @@ -86,7 +86,7 @@ public function __construct($value, Zend_Memory_Container_Movable $container) * @param integer $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return $offset >= 0 && $offset < strlen($this->_value); } @@ -96,9 +96,9 @@ public function offsetExists($offset) * Get character at $offset position * * @param integer $offset - * @return string + * @return string|null */ - public function offsetGet($offset) + public function offsetGet($offset): ?string { return $this->_value[$offset]; } @@ -110,7 +110,7 @@ public function offsetGet($offset) * @param integer $offset * @param string $char */ - public function offsetSet($offset, $char) + public function offsetSet($offset, $char): void { $this->_value[$offset] = $char; @@ -126,7 +126,7 @@ public function offsetSet($offset, $char) * * @param integer $offset */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->_value[$offset]); diff --git a/library/Zend/Navigation/Container.php b/library/Zend/Navigation/Container.php index 8a05075f07..2fbd8b8a2b 100644 --- a/library/Zend/Navigation/Container.php +++ b/library/Zend/Navigation/Container.php @@ -509,7 +509,7 @@ public function toArray() * @return Zend_Navigation_Page current page or null * @throws Zend_Navigation_Exception if the index is invalid */ - public function current() + public function current(): Zend_Navigation_Page { $this->_sort(); current($this->_index); @@ -530,9 +530,9 @@ public function current() * * Implements RecursiveIterator interface. * - * @return string hash code of current page + * @return string|null hash code of current page */ - public function key() + public function key(): ?string { $this->_sort(); return key($this->_index); @@ -545,7 +545,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_sort(); next($this->_index); @@ -558,7 +558,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_sort(); reset($this->_index); @@ -571,7 +571,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $this->_sort(); return current($this->_index) !== false; @@ -584,7 +584,7 @@ public function valid() * * @return bool whether container has any pages */ - public function hasChildren() + public function hasChildren(): bool { return $this->hasPages(); } @@ -596,7 +596,7 @@ public function hasChildren() * * @return Zend_Navigation_Page|null */ - public function getChildren() + public function getChildren(): ?Zend_Navigation_Page { $hash = key($this->_index); @@ -616,7 +616,7 @@ public function getChildren() * * @return int number of pages in the container */ - public function count() + public function count(): int { return count($this->_index); } diff --git a/library/Zend/OpenId/Consumer/Storage/File.php b/library/Zend/OpenId/Consumer/Storage/File.php index a1a96b8540..4219e79c03 100644 --- a/library/Zend/OpenId/Consumer/Storage/File.php +++ b/library/Zend/OpenId/Consumer/Storage/File.php @@ -486,7 +486,7 @@ public function purgeNonces($date=null) unset($nonceFiles); } else { if (is_string($date)) { - $time = time($date); + $time = strtotime($date); } else { $time = $date; } diff --git a/library/Zend/Paginator.php b/library/Zend/Paginator.php index 2ffff97378..5308e9edc0 100644 --- a/library/Zend/Paginator.php +++ b/library/Zend/Paginator.php @@ -514,7 +514,7 @@ public function setCacheEnabled($enable) * * @return integer */ - public function count() + public function count(): int { if (!$this->_pageCount) { $this->_pageCount = $this->_calculatePageCount(); @@ -818,7 +818,7 @@ public function getItemsByPage($pageNumber) * * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return $this->getCurrentItems(); } diff --git a/library/Zend/Paginator/Adapter/Array.php b/library/Zend/Paginator/Adapter/Array.php index 14fd2364eb..088e7a2926 100644 --- a/library/Zend/Paginator/Adapter/Array.php +++ b/library/Zend/Paginator/Adapter/Array.php @@ -74,7 +74,7 @@ public function getItems($offset, $itemCountPerPage) * * @return integer */ - public function count() + public function count(): int { return $this->_count; } diff --git a/library/Zend/Paginator/Adapter/DbSelect.php b/library/Zend/Paginator/Adapter/DbSelect.php index 3a9a41cb70..4554b0f6ca 100644 --- a/library/Zend/Paginator/Adapter/DbSelect.php +++ b/library/Zend/Paginator/Adapter/DbSelect.php @@ -175,7 +175,7 @@ public function getItems($offset, $itemCountPerPage) * * @return integer */ - public function count() + public function count(): int { if ($this->_rowCount === null) { $this->setRowCount( diff --git a/library/Zend/Paginator/Adapter/Iterator.php b/library/Zend/Paginator/Adapter/Iterator.php index 305f8ad585..8583d7e92a 100644 --- a/library/Zend/Paginator/Adapter/Iterator.php +++ b/library/Zend/Paginator/Adapter/Iterator.php @@ -95,7 +95,7 @@ public function getItems($offset, $itemCountPerPage) * * @return integer */ - public function count() + public function count(): int { return $this->_count; } diff --git a/library/Zend/Paginator/Adapter/Null.php b/library/Zend/Paginator/Adapter/Null.php index 12ed9f2a94..7f728d5ab2 100644 --- a/library/Zend/Paginator/Adapter/Null.php +++ b/library/Zend/Paginator/Adapter/Null.php @@ -73,7 +73,7 @@ public function getItems($offset, $itemCountPerPage) * * @return integer */ - public function count() + public function count(): int { return $this->_count; } diff --git a/library/Zend/Paginator/SerializableLimitIterator.php b/library/Zend/Paginator/SerializableLimitIterator.php index 72c1399c9d..34be0e7f18 100644 --- a/library/Zend/Paginator/SerializableLimitIterator.php +++ b/library/Zend/Paginator/SerializableLimitIterator.php @@ -86,7 +86,7 @@ public function unserialize($data) * @param int $offset * @return mixed */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { $currentOffset = $this->key(); $this->seek($offset); @@ -102,7 +102,7 @@ public function offsetGet($offset) * @param int $offset * @param mixed $value */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { } @@ -111,7 +111,7 @@ public function offsetSet($offset, $value) * * @param int $offset */ - public function offsetExists($offset) + public function offsetExists($offset): bool { if ($offset > 0 && $offset < $this->_count) { try { @@ -136,7 +136,7 @@ public function offsetExists($offset) * * @param int $offset */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { } } diff --git a/library/Zend/Pdf/Action.php b/library/Zend/Pdf/Action.php index 2b1864c46f..7995efcdc7 100644 --- a/library/Zend/Pdf/Action.php +++ b/library/Zend/Pdf/Action.php @@ -324,9 +324,9 @@ public function dumpAction(Zend_Pdf_ElementFactory_Interface $factory, SplObject /** * Returns current child action. * - * @return Zend_Pdf_Action + * @return Zend_Pdf_Action|false */ - public function current() + public function current(): Zend_Pdf_Action|false { return current($this->next); } @@ -334,9 +334,9 @@ public function current() /** * Returns current iterator key * - * @return integer + * @return integer|null */ - public function key() + public function key(): ?int { return key($this->next); } @@ -344,6 +344,7 @@ public function key() /** * Go to next child */ + #[ReturnTypeWillChange] public function next() { return next($this->next); @@ -352,6 +353,7 @@ public function next() /** * Rewind children */ + #[ReturnTypeWillChange] public function rewind() { return reset($this->next); @@ -362,7 +364,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return current($this->next) !== false; } @@ -372,7 +374,7 @@ public function valid() * * @return Zend_Pdf_Action|null */ - public function getChildren() + public function getChildren(): ?Zend_Pdf_Action { return current($this->next); } @@ -397,7 +399,7 @@ public function hasChildren() * * @return int */ - public function count() + public function count(): int { return count($this->childOutlines); } diff --git a/library/Zend/Pdf/Element/Reference.php b/library/Zend/Pdf/Element/Reference.php index 27ca760b7a..37b76cf493 100644 --- a/library/Zend/Pdf/Element/Reference.php +++ b/library/Zend/Pdf/Element/Reference.php @@ -88,7 +88,7 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element * @param Zend_Pdf_ElementFactory $factory * @throws Zend_Pdf_Exception */ - public function __construct($objNum, $genNum = 0, Zend_Pdf_Element_Reference_Context $context, Zend_Pdf_ElementFactory $factory) + public function __construct($objNum, $genNum = 0, Zend_Pdf_Element_Reference_Context $context = null, Zend_Pdf_ElementFactory $factory = null) { if ( !(is_integer($objNum) && $objNum > 0) ) { require_once 'Zend/Pdf/Exception.php'; @@ -98,6 +98,14 @@ public function __construct($objNum, $genNum = 0, Zend_Pdf_Element_Reference_Con require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Generation number must be non-negative integer'); } + if ($context === null) { + require_once 'Zend/Pdf/Exception.php'; + throw new Zend_Pdf_Exception('Context argument is not defined'); + } + if ($factory === null) { + require_once 'Zend/Pdf/Exception.php'; + throw new Zend_Pdf_Exception('Factory argument is not defined'); + } $this->_objNum = $objNum; $this->_genNum = $genNum; diff --git a/library/Zend/Pdf/FileParser/Font/OpenType.php b/library/Zend/Pdf/FileParser/Font/OpenType.php index 05a1d96ba4..19bdc578e5 100644 --- a/library/Zend/Pdf/FileParser/Font/OpenType.php +++ b/library/Zend/Pdf/FileParser/Font/OpenType.php @@ -898,7 +898,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 +917,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 +929,7 @@ protected function _parseCmapTable() default: $this->_debugLog('Unknown subtable format: 0x%x; skipping', $format); - continue; + continue 2; } $cmapType = $format; break; diff --git a/library/Zend/Pdf/Filter/Compression/Flate.php b/library/Zend/Pdf/Filter/Compression/Flate.php index 8e4bc93e41..d9a70e6eb3 100644 --- a/library/Zend/Pdf/Filter/Compression/Flate.php +++ b/library/Zend/Pdf/Filter/Compression/Flate.php @@ -47,16 +47,10 @@ public static function encode($data, $params = null) } if (extension_loaded('zlib')) { - $trackErrors = ini_get( "track_errors"); - ini_set('track_errors', '1'); - if (($output = @gzcompress($data)) === false) { - ini_set('track_errors', $trackErrors); require_once 'Zend/Pdf/Exception.php'; - throw new Zend_Pdf_Exception($php_errormsg); + throw new Zend_Pdf_Exception(error_get_last()['message'] ?? 'Unknown error'); } - - ini_set('track_errors', $trackErrors); } else { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Not implemented yet. You have to use zlib extension.'); @@ -75,19 +69,11 @@ public static function encode($data, $params = null) */ public static function decode($data, $params = null) { - global $php_errormsg; - if (extension_loaded('zlib')) { - $trackErrors = ini_get( "track_errors"); - ini_set('track_errors', '1'); - if (($output = @gzuncompress($data)) === false) { - ini_set('track_errors', $trackErrors); require_once 'Zend/Pdf/Exception.php'; - throw new Zend_Pdf_Exception($php_errormsg); + throw new Zend_Pdf_Exception(error_get_last()['message'] ?? 'Unknown error'); } - - ini_set('track_errors', $trackErrors); } else { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Not implemented yet'); diff --git a/library/Zend/Pdf/NameTree.php b/library/Zend/Pdf/NameTree.php index 36614e67d0..80e6ae3609 100644 --- a/library/Zend/Pdf/NameTree.php +++ b/library/Zend/Pdf/NameTree.php @@ -85,48 +85,50 @@ public function __construct(Zend_Pdf_Element $rootDictionary) } } - public function current() + public function current(): mixed { return current($this->_items); } + #[ReturnTypeWillChange] public function next() { return next($this->_items); } - public function key() + public function key(): mixed { return key($this->_items); } - public function valid() { + public function valid(): bool + { return current($this->_items)!==false; } - public function rewind() + public function rewind(): void { reset($this->_items); } - public function offsetExists($offset) + public function offsetExists($offset): bool { return array_key_exists($offset, $this->_items); } - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->_items[$offset]; } - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if ($offset === null) { $this->_items[] = $value; @@ -136,7 +138,7 @@ public function offsetSet($offset, $value) } - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->_items[$offset]); } @@ -147,7 +149,7 @@ public function clear() $this->_items = array(); } - public function count() + public function count(): int { return count($this->_items); } diff --git a/library/Zend/Pdf/Outline.php b/library/Zend/Pdf/Outline.php index 688a287a5b..817793dca8 100644 --- a/library/Zend/Pdf/Outline.php +++ b/library/Zend/Pdf/Outline.php @@ -293,9 +293,9 @@ abstract public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory, /** * Returns the child outline. * - * @return Zend_Pdf_Outline + * @return Zend_Pdf_Action|false */ - public function current() + public function current(): Zend_Pdf_Action|false { return current($this->childOutlines); } @@ -305,7 +305,7 @@ public function current() * * @return integer */ - public function key() + public function key(): ?int { return key($this->childOutlines); } @@ -313,6 +313,7 @@ public function key() /** * Go to next child */ + #[ReturnTypeWillChange] public function next() { return next($this->childOutlines); @@ -321,6 +322,7 @@ public function next() /** * Rewind children */ + #[ReturnTypeWillChange] public function rewind() { return reset($this->childOutlines); @@ -331,7 +333,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return current($this->childOutlines) !== false; } @@ -341,7 +343,7 @@ public function valid() * * @return Zend_Pdf_Outline|null */ - public function getChildren() + public function getChildren(): ?Zend_Pdf_Outline { return current($this->childOutlines); } @@ -366,7 +368,7 @@ public function hasChildren() * * @return int */ - public function count() + public function count(): int { return count($this->childOutlines); } diff --git a/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php b/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php index c3d9cd2b4b..232a40ec22 100644 --- a/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php +++ b/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php @@ -33,13 +33,18 @@ class Zend_Pdf_RecursivelyIteratableObjectsContainer implements RecursiveIterato public function __construct(array $objects) { $this->_objects = $objects; } - public function current() { return current($this->_objects); } - public function key() { return key($this->_objects); } - public function next() { return next($this->_objects); } - public function rewind() { return reset($this->_objects); } - public function valid() { return current($this->_objects) !== false; } - public function getChildren() { return current($this->_objects); } + public function current(): mixed { return current($this->_objects); } + public function key(): mixed { return key($this->_objects); } + #[ReturnTypeWillChange] public function next() { return next($this->_objects); } + #[ReturnTypeWillChange] public function rewind() { return reset($this->_objects); } + public function valid(): bool { return current($this->_objects) !== false; } + + public function getChildren(): ?RecursiveIterator + { + return current($this->_objects); + } + public function hasChildren() { return count($this->_objects) > 0; } - public function count() { return count($this->_objects); } + public function count(): int { return count($this->_objects); } } diff --git a/library/Zend/Queue.php b/library/Zend/Queue.php index 5a0d2456e6..a4cec77df4 100644 --- a/library/Zend/Queue.php +++ b/library/Zend/Queue.php @@ -421,7 +421,7 @@ public function send($message) * * @return integer */ - public function count() + public function count(): int { if ($this->getAdapter()->isSupported('count')) { return $this->getAdapter()->count(); diff --git a/library/Zend/Queue/Message/Iterator.php b/library/Zend/Queue/Message/Iterator.php index d45ecf5d1c..6635a2d8e1 100644 --- a/library/Zend/Queue/Message/Iterator.php +++ b/library/Zend/Queue/Message/Iterator.php @@ -212,7 +212,7 @@ public function getQueueClass() * * @return void */ - public function rewind() + public function rewind(): void { $this->_pointer = 0; } @@ -224,7 +224,7 @@ public function rewind() * * @return Zend_Queue_Message current element from the collection */ - public function current() + public function current(): ?Zend_Queue_Message { return (($this->valid() === false) ? null @@ -238,7 +238,7 @@ public function current() * * @return integer */ - public function key() + public function key(): int { return $this->_pointer; } @@ -250,7 +250,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { ++$this->_pointer; } @@ -262,7 +262,7 @@ public function next() * * @return bool False if there's nothing more to iterate over */ - public function valid() + public function valid(): bool { return $this->_pointer < count($this); } @@ -278,7 +278,7 @@ public function valid() * * @return integer */ - public function count() + public function count(): int { return count($this->_data); } diff --git a/library/Zend/Reflection/Class.php b/library/Zend/Reflection/Class.php index 4819ef8695..22ecd48ffe 100644 --- a/library/Zend/Reflection/Class.php +++ b/library/Zend/Reflection/Class.php @@ -83,9 +83,9 @@ public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock') * Return the start line of the class * * @param bool $includeDocComment - * @return int + * @return int|false */ - public function getStartLine($includeDocComment = false) + public function getStartLine($includeDocComment = false): int|false { if ($includeDocComment) { if ($this->getDocComment() != '') { @@ -118,7 +118,7 @@ public function getContents($includeDocblock = true) * @param string $reflectionClass Name of reflection class to use * @return array Array of Zend_Reflection_Class */ - public function getInterfaces($reflectionClass = 'Zend_Reflection_Class') + public function getInterfaces($reflectionClass = 'Zend_Reflection_Class'): array { $phpReflections = parent::getInterfaces(); $zendReflections = array(); @@ -142,7 +142,7 @@ public function getInterfaces($reflectionClass = 'Zend_Reflection_Class') * @param string $reflectionClass Reflection class to utilize * @return Zend_Reflection_Method */ - public function getMethod($name, $reflectionClass = 'Zend_Reflection_Method') + public function getMethod($name, $reflectionClass = 'Zend_Reflection_Method'): Zend_Reflection_Method { $phpReflection = parent::getMethod($name); $zendReflection = new $reflectionClass($this->getName(), $phpReflection->getName()); @@ -163,7 +163,7 @@ public function getMethod($name, $reflectionClass = 'Zend_Reflection_Method') * @param string $reflectionClass Reflection class to use for methods * @return array Array of Zend_Reflection_Method objects */ - public function getMethods($filter = -1, $reflectionClass = 'Zend_Reflection_Method') + public function getMethods($filter = -1, $reflectionClass = 'Zend_Reflection_Method'): array { $phpReflections = parent::getMethods($filter); $zendReflections = array(); @@ -184,9 +184,9 @@ public function getMethods($filter = -1, $reflectionClass = 'Zend_Reflection_Met * Get parent reflection class of reflected class * * @param string $reflectionClass Name of Reflection class to use - * @return Zend_Reflection_Class + * @return Zend_Reflection_Class|false */ - public function getParentClass($reflectionClass = 'Zend_Reflection_Class') + public function getParentClass($reflectionClass = 'Zend_Reflection_Class'): Zend_Reflection_Class|false { $phpReflection = parent::getParentClass(); if ($phpReflection) { @@ -209,7 +209,7 @@ public function getParentClass($reflectionClass = 'Zend_Reflection_Class') * @param string $reflectionClass Name of reflection class to use * @return Zend_Reflection_Property */ - public function getProperty($name, $reflectionClass = 'Zend_Reflection_Property') + public function getProperty($name, $reflectionClass = 'Zend_Reflection_Property'): Zend_Reflection_Property { $phpReflection = parent::getProperty($name); $zendReflection = new $reflectionClass($this->getName(), $phpReflection->getName()); @@ -228,7 +228,7 @@ public function getProperty($name, $reflectionClass = 'Zend_Reflection_Property' * @param string $reflectionClass Name of reflection class to use * @return array Array of Zend_Reflection_Property */ - public function getProperties($filter = -1, $reflectionClass = 'Zend_Reflection_Property') + public function getProperties($filter = -1, $reflectionClass = 'Zend_Reflection_Property'): array { $phpReflections = parent::getProperties($filter); $zendReflections = array(); diff --git a/library/Zend/Reflection/Extension.php b/library/Zend/Reflection/Extension.php index 37d4fea157..343f94379b 100644 --- a/library/Zend/Reflection/Extension.php +++ b/library/Zend/Reflection/Extension.php @@ -43,7 +43,7 @@ class Zend_Reflection_Extension extends ReflectionExtension * @param string $reflectionClass Name of reflection class to use * @return array Array of Zend_Reflection_Function objects */ - public function getFunctions($reflectionClass = 'Zend_Reflection_Function') + public function getFunctions($reflectionClass = 'Zend_Reflection_Function'): array { $phpReflections = parent::getFunctions(); $zendReflections = array(); @@ -66,7 +66,7 @@ public function getFunctions($reflectionClass = 'Zend_Reflection_Function') * @param string $reflectionClass Name of reflection class to use * @return array Array of Zend_Reflection_Class objects */ - public function getClasses($reflectionClass = 'Zend_Reflection_Class') + public function getClasses($reflectionClass = 'Zend_Reflection_Class'): array { $phpReflections = parent::getClasses(); $zendReflections = array(); 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: diff --git a/library/Zend/Reflection/Function.php b/library/Zend/Reflection/Function.php index ac7f448011..b4ac99e9de 100644 --- a/library/Zend/Reflection/Function.php +++ b/library/Zend/Reflection/Function.php @@ -56,9 +56,9 @@ public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock') * Get start line (position) of function * * @param bool $includeDocComment - * @return int + * @return int|false */ - public function getStartLine($includeDocComment = false) + public function getStartLine($includeDocComment = false): int|false { if ($includeDocComment) { if ($this->getDocComment() != '') { @@ -93,7 +93,7 @@ public function getContents($includeDocblock = true) * @param string $reflectionClass Name of reflection class to use * @return array Array of Zend_Reflection_Parameter */ - public function getParameters($reflectionClass = 'Zend_Reflection_Parameter') + public function getParameters($reflectionClass = 'Zend_Reflection_Parameter'): array { $phpReflections = parent::getParameters(); $zendReflections = array(); diff --git a/library/Zend/Reflection/Method.php b/library/Zend/Reflection/Method.php index 02e5d7fbcd..99e551c74c 100644 --- a/library/Zend/Reflection/Method.php +++ b/library/Zend/Reflection/Method.php @@ -67,9 +67,9 @@ public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock') * Get start line (position) of method * * @param bool $includeDocComment - * @return int + * @return int|false */ - public function getStartLine($includeDocComment = false) + public function getStartLine($includeDocComment = false): int|false { if ($includeDocComment) { if ($this->getDocComment() != '') { @@ -86,7 +86,7 @@ public function getStartLine($includeDocComment = false) * @param string $reflectionClass Name of reflection class to use * @return Zend_Reflection_Class */ - public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') + public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class'): Zend_Reflection_Class { $phpReflection = parent::getDeclaringClass(); $zendReflection = new $reflectionClass($phpReflection->getName()); @@ -104,7 +104,7 @@ public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') * @param string $reflectionClass Name of reflection class to use * @return array of Zend_Reflection_Parameter objects */ - public function getParameters($reflectionClass = 'Zend_Reflection_Parameter') + public function getParameters($reflectionClass = 'Zend_Reflection_Parameter'): array { $phpReflections = parent::getParameters(); $zendReflections = array(); diff --git a/library/Zend/Reflection/Parameter.php b/library/Zend/Reflection/Parameter.php index 1800af0e8b..f6b9fe4bc7 100644 --- a/library/Zend/Reflection/Parameter.php +++ b/library/Zend/Reflection/Parameter.php @@ -38,7 +38,7 @@ class Zend_Reflection_Parameter extends ReflectionParameter * @param string $reflectionClass Reflection class to use * @return Zend_Reflection_Class */ - public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') + public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class'): Zend_Reflection_Class { $phpReflection = parent::getDeclaringClass(); $zendReflection = new $reflectionClass($phpReflection->getName()); @@ -54,9 +54,9 @@ public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') * Get class reflection object * * @param string $reflectionClass Reflection class to use - * @return Zend_Reflection_Class + * @return Zend_Reflection_Class|null */ - public function getClass($reflectionClass = 'Zend_Reflection_Class') + public function getClass($reflectionClass = 'Zend_Reflection_Class'): ?Zend_Reflection_Class { $phpReflection = parent::getClass(); if($phpReflection == null) { @@ -78,7 +78,7 @@ public function getClass($reflectionClass = 'Zend_Reflection_Class') * @param string $reflectionClass Reflection class to use * @return Zend_Reflection_Function|Zend_Reflection_Method */ - public function getDeclaringFunction($reflectionClass = null) + public function getDeclaringFunction($reflectionClass = null): Zend_Reflection_Function|Zend_Reflection_Method { $phpReflection = parent::getDeclaringFunction(); if ($phpReflection instanceof ReflectionMethod) { @@ -105,9 +105,10 @@ public function getDeclaringFunction($reflectionClass = null) /** * Get parameter type * - * @return string + * @return string|null */ - public function getType() + #[ReturnTypeWillChange] + public function getType(): ?string { if ($docblock = $this->getDeclaringFunction()->getDocblock()) { $params = $docblock->getTags('param'); diff --git a/library/Zend/Reflection/Property.php b/library/Zend/Reflection/Property.php index 95a936f9ee..7a330b068a 100644 --- a/library/Zend/Reflection/Property.php +++ b/library/Zend/Reflection/Property.php @@ -33,7 +33,7 @@ class Zend_Reflection_Property extends ReflectionProperty * * @return Zend_Reflection_Class */ - public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') + public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class'): Zend_Reflection_Class { $phpReflection = parent::getDeclaringClass(); $zendReflection = new $reflectionClass($phpReflection->getName()); @@ -51,7 +51,8 @@ public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') * @param string $reflectionClass * @return Zend_Reflection_Docblock|false False if no docblock defined */ - public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock') + #[ReturnTypeWillChange] + public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock'): Zend_Reflection_Docblock|false { $docblock = parent::getDocComment(); if (!$docblock) { 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); - } - } diff --git a/library/Zend/Rest/Client/Result.php b/library/Zend/Rest/Client/Result.php index 26908427b3..7f362bb320 100644 --- a/library/Zend/Rest/Client/Result.php +++ b/library/Zend/Rest/Client/Result.php @@ -169,7 +169,7 @@ public function __isset($name) * * @return SimpleXMLIterator */ - public function getIterator() + public function getIterator(): SimpleXMLIterator { return $this->_sxml; } diff --git a/library/Zend/Rest/Route.php b/library/Zend/Rest/Route.php index 2b7cdd6241..6e23ac2c7d 100644 --- a/library/Zend/Rest/Route.php +++ b/library/Zend/Rest/Route.php @@ -239,9 +239,10 @@ public function match($request, $partial = false) * @param array $data An array of variable and value pairs used as parameters * @param bool $reset Weither to reset the current params * @param bool $encode Weither to return urlencoded string + * @param bool $partial * @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/Search/Lucene.php b/library/Zend/Search/Lucene.php index 89e0dab523..1d0e416397 100644 --- a/library/Zend/Search/Lucene.php +++ b/library/Zend/Search/Lucene.php @@ -665,7 +665,7 @@ public function getDirectory() * * @return integer */ - public function count() + public function count(): int { return $this->_docCount; } diff --git a/library/Zend/Search/Lucene/Index/Term.php b/library/Zend/Search/Lucene/Index/Term.php index b2328384dc..0ce7ce7261 100644 --- a/library/Zend/Search/Lucene/Index/Term.php +++ b/library/Zend/Search/Lucene/Index/Term.php @@ -67,7 +67,7 @@ public function __construct($text, $field = null) * * @return string */ - public function key() + public function key(): string { return $this->field . chr(0) . $this->text; } diff --git a/library/Zend/Search/Lucene/Storage/Directory/Filesystem.php b/library/Zend/Search/Lucene/Storage/Directory/Filesystem.php index 489f9c3d30..402d3a8eb7 100644 --- a/library/Zend/Search/Lucene/Storage/Directory/Filesystem.php +++ b/library/Zend/Search/Lucene/Storage/Directory/Filesystem.php @@ -207,15 +207,11 @@ public function deleteFile($filename) } unset($this->_fileHandlers[$filename]); - global $php_errormsg; - $trackErrors = ini_get('track_errors'); - ini_set('track_errors', '1'); if (!@unlink($this->_dirPath . '/' . $filename)) { - ini_set('track_errors', $trackErrors); require_once 'Zend/Search/Lucene/Exception.php'; - throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $php_errormsg); + $message = error_get_last()['message'] ?? 'Unknown error'; + throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $message); } - ini_set('track_errors', $trackErrors); } /** @@ -285,8 +281,6 @@ public function fileModified($filename) */ public function renameFile($from, $to) { - global $php_errormsg; - if (isset($this->_fileHandlers[$from])) { $this->_fileHandlers[$from]->close(); } @@ -304,18 +298,12 @@ public function renameFile($from, $to) } } - $trackErrors = ini_get('track_errors'); - ini_set('track_errors', '1'); - $success = @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to); if (!$success) { - ini_set('track_errors', $trackErrors); require_once 'Zend/Search/Lucene/Exception.php'; - throw new Zend_Search_Lucene_Exception($php_errormsg); + throw new Zend_Search_Lucene_Exception(error_get_last()['message'] ?? 'Unknown error'); } - ini_set('track_errors', $trackErrors); - return $success; } diff --git a/library/Zend/Search/Lucene/Storage/File/Filesystem.php b/library/Zend/Search/Lucene/Storage/File/Filesystem.php index 95d08a4e57..6bf246f4ab 100644 --- a/library/Zend/Search/Lucene/Storage/File/Filesystem.php +++ b/library/Zend/Search/Lucene/Storage/File/Filesystem.php @@ -48,26 +48,18 @@ class Zend_Search_Lucene_Storage_File_Filesystem extends Zend_Search_Lucene_Stor */ public function __construct($filename, $mode='r+b') { - global $php_errormsg; - if (strpos($mode, 'w') === false && !is_readable($filename)) { // opening for reading non-readable file require_once 'Zend/Search/Lucene/Exception.php'; throw new Zend_Search_Lucene_Exception('File \'' . $filename . '\' is not readable.'); } - $trackErrors = ini_get('track_errors'); - ini_set('track_errors', '1'); - $this->_fileHandle = @fopen($filename, $mode); if ($this->_fileHandle === false) { - ini_set('track_errors', $trackErrors); require_once 'Zend/Search/Lucene/Exception.php'; - throw new Zend_Search_Lucene_Exception($php_errormsg); + throw new Zend_Search_Lucene_Exception(error_get_last()['message'] ?? 'Unknown error'); } - - ini_set('track_errors', $trackErrors); } /** diff --git a/library/Zend/Server/Definition.php b/library/Zend/Server/Definition.php index 1d8db47c54..c962ccc5e3 100644 --- a/library/Zend/Server/Definition.php +++ b/library/Zend/Server/Definition.php @@ -210,7 +210,7 @@ public function toArray() * * @return int */ - public function count() + public function count(): int { return count($this->_methods); } @@ -220,7 +220,7 @@ public function count() * * @return mixed */ - public function current() + public function current(): mixed { return current($this->_methods); } @@ -228,9 +228,9 @@ public function current() /** * Iterator: current item key * - * @return int|string + * @return string|int|null */ - public function key() + public function key(): string|int|null { return key($this->_methods); } @@ -240,6 +240,7 @@ public function key() * * @return void */ + #[ReturnTypeWillChange] public function next() { return next($this->_methods); @@ -250,6 +251,7 @@ public function next() * * @return void */ + #[ReturnTypeWillChange] public function rewind() { return reset($this->_methods); @@ -260,7 +262,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { return (bool) $this->current(); } diff --git a/library/Zend/Service/Amazon/ResultSet.php b/library/Zend/Service/Amazon/ResultSet.php index 767aca6395..25fad6bd0f 100644 --- a/library/Zend/Service/Amazon/ResultSet.php +++ b/library/Zend/Service/Amazon/ResultSet.php @@ -106,7 +106,7 @@ public function totalPages() * * @return Zend_Service_Amazon_Item */ - public function current() + public function current(): Zend_Service_Amazon_Item { return new Zend_Service_Amazon_Item($this->_results->item($this->_currentIndex)); } @@ -116,7 +116,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->_currentIndex; } @@ -126,7 +126,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_currentIndex += 1; } @@ -136,7 +136,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_currentIndex = 0; } @@ -163,7 +163,7 @@ public function seek($index) * * @return boolean */ - public function valid() + public function valid(): bool { return null !== $this->_results && $this->_currentIndex < $this->_results->length; } diff --git a/library/Zend/Service/Console/Command.php b/library/Zend/Service/Console/Command.php index 22135451b9..fb53055d00 100644 --- a/library/Zend/Service/Console/Command.php +++ b/library/Zend/Service/Console/Command.php @@ -220,7 +220,7 @@ protected static function _buildModel() for ($hi = 0; $hi < count($handlers); $hi++) { $handler = $handlers[$hi]; - $handlerDescription = isset($handlerDescriptions[$hi]) ? $handlerDescriptions[$hi] : isset($handlerDescriptions[0]) ? $handlerDescriptions[0] : ''; + $handlerDescription = $handlerDescriptions[$hi] ?? $handlerDescriptions[0] ?? ''; $handlerDescription = str_replace('\r\n', "\r\n", $handlerDescription); $handlerDescription = str_replace('\n', "\n", $handlerDescription); diff --git a/library/Zend/Service/Delicious/PostList.php b/library/Zend/Service/Delicious/PostList.php index bf46662b9f..df4936f956 100644 --- a/library/Zend/Service/Delicious/PostList.php +++ b/library/Zend/Service/Delicious/PostList.php @@ -161,7 +161,7 @@ public function withUrl($regexp) * * @return int */ - public function count() + public function count(): int { return count($this->_posts); } @@ -173,7 +173,7 @@ public function count() * * @return Zend_Service_Delicious_SimplePost */ - public function current() + public function current(): ?Zend_Service_Delicious_SimplePost { return $this->_posts[$this->_iteratorKey]; } @@ -185,7 +185,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->_iteratorKey; } @@ -197,7 +197,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_iteratorKey += 1; } @@ -209,7 +209,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_iteratorKey = 0; } @@ -221,7 +221,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); @@ -240,7 +240,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -254,7 +254,7 @@ public function offsetExists($offset) * @throws OutOfBoundsException * @return Zend_Service_Delicious_SimplePost */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Service_Delicious_SimplePost { if ($this->offsetExists($offset)) { return $this->_posts[$offset]; @@ -272,7 +272,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Service_Delicious_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { /** * @see Zend_Service_Delicious_Exception @@ -289,7 +289,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Service_Delicious_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { /** * @see Zend_Service_Delicious_Exception diff --git a/library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php b/library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php index 7b236267cd..726bc7b550 100644 --- a/library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php +++ b/library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php @@ -40,7 +40,7 @@ class Zend_Service_Ebay_Finding_Aspect_Histogram_Value_Set extends Zend_Service_ * * @return Zend_Service_Ebay_Finding_Aspect_Histogram_Value */ - public function current() + public function current(): ?Zend_Service_Ebay_Finding_Aspect_Histogram_Value { // check node $node = $this->_nodes->item($this->_key); diff --git a/library/Zend/Service/Ebay/Finding/Aspect/Set.php b/library/Zend/Service/Ebay/Finding/Aspect/Set.php index 1ba41bf70a..6e42571717 100644 --- a/library/Zend/Service/Ebay/Finding/Aspect/Set.php +++ b/library/Zend/Service/Ebay/Finding/Aspect/Set.php @@ -40,7 +40,7 @@ class Zend_Service_Ebay_Finding_Aspect_Set extends Zend_Service_Ebay_Finding_Set * * @return Zend_Service_Ebay_Finding_Aspect */ - public function current() + public function current(): ?Zend_Service_Ebay_Finding_Aspect { // check node $node = $this->_nodes->item($this->_key); diff --git a/library/Zend/Service/Ebay/Finding/Category/Histogram/Set.php b/library/Zend/Service/Ebay/Finding/Category/Histogram/Set.php index 1415bc3b91..892f871602 100644 --- a/library/Zend/Service/Ebay/Finding/Category/Histogram/Set.php +++ b/library/Zend/Service/Ebay/Finding/Category/Histogram/Set.php @@ -40,7 +40,7 @@ class Zend_Service_Ebay_Finding_Category_Histogram_Set extends Zend_Service_Ebay * * @return Zend_Service_Ebay_Finding_Category_Histogram */ - public function current() + public function current(): ?Zend_Service_Ebay_Finding_Category_Histogram { // check node $node = $this->_nodes->item($this->_key); diff --git a/library/Zend/Service/Ebay/Finding/Error/Data/Set.php b/library/Zend/Service/Ebay/Finding/Error/Data/Set.php index 5bafbf3158..2ffe15d3d2 100644 --- a/library/Zend/Service/Ebay/Finding/Error/Data/Set.php +++ b/library/Zend/Service/Ebay/Finding/Error/Data/Set.php @@ -40,7 +40,7 @@ class Zend_Service_Ebay_Finding_Error_Data_Set extends Zend_Service_Ebay_Finding * * @return Zend_Service_Ebay_Finding_Error_Data */ - public function current() + public function current(): ?Zend_Service_Ebay_Finding_Error_Data { // check node $node = $this->_nodes->item($this->_key); diff --git a/library/Zend/Service/Ebay/Finding/Search/Item/Set.php b/library/Zend/Service/Ebay/Finding/Search/Item/Set.php index 57a3727fe5..aa7fceb431 100644 --- a/library/Zend/Service/Ebay/Finding/Search/Item/Set.php +++ b/library/Zend/Service/Ebay/Finding/Search/Item/Set.php @@ -40,7 +40,7 @@ class Zend_Service_Ebay_Finding_Search_Item_Set extends Zend_Service_Ebay_Findin * * @return Zend_Service_Ebay_Finding_Search_Item */ - public function current() + public function current(): ?Zend_Service_Ebay_Finding_Search_Item { // check node $node = $this->_nodes->item($this->_key); diff --git a/library/Zend/Service/Ebay/Finding/Set/Abstract.php b/library/Zend/Service/Ebay/Finding/Set/Abstract.php index 08abf109f9..e9ecc50cdd 100644 --- a/library/Zend/Service/Ebay/Finding/Set/Abstract.php +++ b/library/Zend/Service/Ebay/Finding/Set/Abstract.php @@ -81,7 +81,7 @@ public function seek($key) * * @return integer */ - public function key() + public function key(): int { return $this->_key; } @@ -91,7 +91,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_key++; } @@ -101,7 +101,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_key = 0; } @@ -111,7 +111,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { return $this->_key >= 0 && $this->_key < $this->count(); } @@ -121,7 +121,7 @@ public function valid() * * @return integer */ - public function count() + public function count(): int { return $this->_nodes ? $this->_nodes->length : 0; } diff --git a/library/Zend/Service/Flickr/ResultSet.php b/library/Zend/Service/Flickr/ResultSet.php index 31dd41050c..9b7e629b25 100644 --- a/library/Zend/Service/Flickr/ResultSet.php +++ b/library/Zend/Service/Flickr/ResultSet.php @@ -123,7 +123,7 @@ public function totalResults() * * @return Zend_Service_Flickr_Result */ - public function current() + public function current(): Zend_Service_Flickr_Result { return new Zend_Service_Flickr_Result($this->_results->item($this->_currentIndex), $this->_flickr); } @@ -133,7 +133,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->_currentIndex; } @@ -143,7 +143,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_currentIndex += 1; } @@ -153,7 +153,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_currentIndex = 0; } @@ -180,7 +180,7 @@ public function seek($index) * * @return boolean */ - public function valid() + public function valid(): bool { return null !== $this->_results && $this->_currentIndex < $this->_results->length; } diff --git a/library/Zend/Service/Rackspace/Files/ContainerList.php b/library/Zend/Service/Rackspace/Files/ContainerList.php index f0650232fb..9ab4899c2a 100644 --- a/library/Zend/Service/Rackspace/Files/ContainerList.php +++ b/library/Zend/Service/Rackspace/Files/ContainerList.php @@ -95,7 +95,7 @@ protected function _addObject (Zend_Service_Rackspace_Files_Container $obj) * * @return int */ - public function count() + public function count(): int { return count($this->objects); } @@ -106,7 +106,7 @@ public function count() * * @return Zend_Service_Rackspace_Files_Container */ - public function current() + public function current(): ?Zend_Service_Rackspace_Files_Container { return $this->objects[$this->iteratorKey]; } @@ -117,7 +117,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -128,7 +128,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey += 1; } @@ -139,7 +139,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -150,7 +150,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -167,7 +167,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -180,7 +180,7 @@ public function offsetExists($offset) * @throws Zend_Service_Rackspace_Files_Exception * @return Zend_Service_Rackspace_Files_Container */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Service_Rackspace_Files_Container { if ($this->offsetExists($offset)) { return $this->objects[$offset]; @@ -199,7 +199,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Service_Rackspace_Files_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception('You are trying to set read-only property'); @@ -213,7 +213,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Service_Rackspace_Files_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Service/Rackspace/Files/ObjectList.php b/library/Zend/Service/Rackspace/Files/ObjectList.php index 99abcb1c45..76f016151c 100644 --- a/library/Zend/Service/Rackspace/Files/ObjectList.php +++ b/library/Zend/Service/Rackspace/Files/ObjectList.php @@ -111,7 +111,7 @@ protected function _addObject (Zend_Service_Rackspace_Files_Object $obj) * * @return int */ - public function count() + public function count(): int { return count($this->objects); } @@ -122,7 +122,7 @@ public function count() * * @return Zend_Service_Rackspace_Files_Object */ - public function current() + public function current(): ?Zend_Service_Rackspace_Files_Object { return $this->objects[$this->iteratorKey]; } @@ -133,7 +133,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -144,7 +144,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey += 1; } @@ -155,7 +155,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -166,7 +166,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -183,7 +183,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -196,7 +196,7 @@ public function offsetExists($offset) * @throws Zend_Service_Rackspace_Files_Exception * @return Zend_Service_Rackspace_Files_Object */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Service_Rackspace_Files_Object { if ($this->offsetExists($offset)) { return $this->objects[$offset]; @@ -215,7 +215,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Service_Rackspace_Files_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception('You are trying to set read-only property'); @@ -229,7 +229,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Service_Rackspace_Files_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Service/Rackspace/Servers/ImageList.php b/library/Zend/Service/Rackspace/Servers/ImageList.php index 2d7848567b..f1e1e3ad6a 100644 --- a/library/Zend/Service/Rackspace/Servers/ImageList.php +++ b/library/Zend/Service/Rackspace/Servers/ImageList.php @@ -108,7 +108,7 @@ public function toArray() * * @return int */ - public function count() + public function count(): int { return count($this->images); } @@ -119,7 +119,7 @@ public function count() * * @return Zend_Service_Rackspace_Servers_Image */ - public function current() + public function current(): ?Zend_Service_Rackspace_Servers_Image { return $this->images[$this->iteratorKey]; } @@ -130,7 +130,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -141,7 +141,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey += 1; } @@ -152,7 +152,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -163,7 +163,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -180,7 +180,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -193,7 +193,7 @@ public function offsetExists($offset) * @throws Zend_Service_Rackspace_Servers_Exception * @return Zend_Service_Rackspace_Servers_Image */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Service_Rackspace_Servers_Image { if ($this->offsetExists($offset)) { return $this->images[$offset]; @@ -212,7 +212,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Service_Rackspace_Servers_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Service/Rackspace/Servers/Exception.php'; throw new Zend_Service_Rackspace_Servers_Exception('You are trying to set read-only property'); @@ -226,7 +226,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Service_Rackspace_Servers_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Service/Rackspace/Servers/Exception.php'; throw new Zend_Service_Rackspace_Servers_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Service/Rackspace/Servers/ServerList.php b/library/Zend/Service/Rackspace/Servers/ServerList.php index 9dda8684ec..e4ca42f174 100644 --- a/library/Zend/Service/Rackspace/Servers/ServerList.php +++ b/library/Zend/Service/Rackspace/Servers/ServerList.php @@ -109,7 +109,7 @@ public function toArray() * * @return int */ - public function count() + public function count(): int { return count($this->servers); } @@ -120,7 +120,7 @@ public function count() * * @return Zend_Service_Rackspace_Servers_Server */ - public function current() + public function current(): ?Zend_Service_Rackspace_Servers_Server { return $this->servers[$this->iteratorKey]; } @@ -131,7 +131,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -142,7 +142,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey += 1; } @@ -153,7 +153,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -164,7 +164,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -181,7 +181,7 @@ public function valid() * @param int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -194,7 +194,7 @@ public function offsetExists($offset) * @throws Zend_Service_Rackspace_Servers_Exception * @return Zend_Service_Rackspace_Servers_Server */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Service_Rackspace_Servers_Server { if ($this->offsetExists($offset)) { return $this->servers[$offset]; @@ -213,7 +213,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Service_Rackspace_Servers_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Service/Rackspace/Servers/Exception.php'; throw new Zend_Service_Rackspace_Servers_Exception('You are trying to set read-only property'); @@ -227,7 +227,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Service_Rackspace_Servers_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Service/Rackspace/Servers/Exception.php'; throw new Zend_Service_Rackspace_Servers_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Service/Rackspace/Servers/SharedIpGroupList.php b/library/Zend/Service/Rackspace/Servers/SharedIpGroupList.php index 476f58a6a5..50efc51ab1 100644 --- a/library/Zend/Service/Rackspace/Servers/SharedIpGroupList.php +++ b/library/Zend/Service/Rackspace/Servers/SharedIpGroupList.php @@ -108,7 +108,7 @@ public function toArray() * * @return int */ - public function count() + public function count(): int { return count($this->shared); } @@ -119,7 +119,7 @@ public function count() * * @return Zend_Service_Rackspace_Servers_SharedIpGroup */ - public function current() + public function current(): ?Zend_Service_Rackspace_Servers_SharedIpGroup { return $this->shared[$this->iteratorKey]; } @@ -130,7 +130,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->iteratorKey; } @@ -141,7 +141,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->iteratorKey += 1; } @@ -152,7 +152,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->iteratorKey = 0; } @@ -163,7 +163,7 @@ public function rewind() * * @return boolean */ - public function valid() + public function valid(): bool { $numItems = $this->count(); if ($numItems > 0 && $this->iteratorKey < $numItems) { @@ -180,7 +180,7 @@ public function valid() * @param int $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return ($offset < $this->count()); } @@ -193,7 +193,7 @@ public function offsetExists($offset) * @throws Zend_Service_Rackspace_Servers_Exception * @return Zend_Service_Rackspace_Servers_SharedIpGroup */ - public function offsetGet($offset) + public function offsetGet($offset): Zend_Service_Rackspace_Servers_SharedIpGroup { if ($this->offsetExists($offset)) { return $this->shared[$offset]; @@ -212,7 +212,7 @@ public function offsetGet($offset) * @param string $value * @throws Zend_Service_Rackspace_Servers_Exception */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { require_once 'Zend/Service/Rackspace/Servers/Exception.php'; throw new Zend_Service_Rackspace_Servers_Exception('You are trying to set read-only property'); @@ -226,7 +226,7 @@ public function offsetSet($offset, $value) * @param int $offset * @throws Zend_Service_Rackspace_Servers_Exception */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { require_once 'Zend/Service/Rackspace/Servers/Exception.php'; throw new Zend_Service_Rackspace_Servers_Exception('You are trying to unset read-only property'); diff --git a/library/Zend/Service/WindowsAzure/CommandLine/Certificate.php b/library/Zend/Service/WindowsAzure/CommandLine/Certificate.php index af79c63a79..d0f0504f3e 100644 --- a/library/Zend/Service/WindowsAzure/CommandLine/Certificate.php +++ b/library/Zend/Service/WindowsAzure/CommandLine/Certificate.php @@ -138,12 +138,12 @@ public function getCertificateCommand($subscriptionId, $certificate, $certificat * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed. * @command-parameter-for $serviceName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --ServiceName|-sn Required. The name of the hosted service. * @command-parameter-for $thumbprint Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --CertificateThumbprint Required. The certificate thumbprint for which to retrieve the certificate. - * @command-parameter-for $algorithm Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --CertificateAlgorithm Required. The certificate's algorithm. * @command-parameter-for $property Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Property|-prop Required. The property to retrieve for the certificate. + * @command-parameter-for $algorithm Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --CertificateAlgorithm Required. The certificate's algorithm. * @command-example Get certificate for service name "phptest": * @command-example Get -sid:"" -cert:"mycert.pem" -sn:"phptest" --CertificateThumbprint:"" --CertificateAlgorithm:"sha1" */ - public function getCertificatePropertyCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $thumbprint, $algorithm = "sha1", $property) + public function getCertificatePropertyCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $thumbprint, $property, $algorithm = "sha1") { $client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase); $result = $client->getCertificate($serviceName, $algorithm, $thumbprint); diff --git a/library/Zend/Service/WindowsAzure/CommandLine/Deployment.php b/library/Zend/Service/WindowsAzure/CommandLine/Deployment.php index 1ff6de6ddd..7791238d9f 100644 --- a/library/Zend/Service/WindowsAzure/CommandLine/Deployment.php +++ b/library/Zend/Service/WindowsAzure/CommandLine/Deployment.php @@ -66,10 +66,10 @@ class Zend_Service_WindowsAzure_CommandLine_Deployment * @command-parameter-for $serviceName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Name Required. The hosted service account name to operate on. * @command-parameter-for $deploymentName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --DeploymentName Required. The name for the deployment. * @command-parameter-for $label Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Label Required. The label for the deployment. + * @command-parameter-for $packageUrl Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --PackageUrl Required. The remote location of the .cspkg file. + * @command-parameter-for $serviceConfigurationLocation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file. * @command-parameter-for $staging Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Staging Host the service in the staging slot. * @command-parameter-for $production Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Production Host the service in the staging slot. - * @command-parameter-for $packageUrl Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --PackageUrl Required. The remote location of the .cspkg file. - * @command-parameter-for $serviceConfigurationLocation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file. * @command-parameter-for $startImmediately Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --StartImmediately Optional. Start the deployment after creation. * @command-parameter-for $warningsAsErrors Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WarningsAsErrors Optional. Treat warnings as errors. * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete? @@ -79,7 +79,7 @@ class Zend_Service_WindowsAzure_CommandLine_Deployment * @command-example --PackageUrl:"http://acct.blob.core.windows.net/pkgs/service.cspkg" * @command-example --ServiceConfigLocation:".\ServiceConfiguration.cscfg" --StartImmediately --WaitFor */ - public function createFromStorageCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentName, $label, $staging = false, $production = false, $packageUrl, $serviceConfigurationLocation, $startImmediately = true, $warningsAsErrors = false, $waitForOperation = false) + public function createFromStorageCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentName, $label, $packageUrl, $serviceConfigurationLocation, $staging = false, $production = false, $startImmediately = true, $warningsAsErrors = false, $waitForOperation = false) { $deploymentSlot = 'staging'; if (!$staging && !$production) { @@ -109,11 +109,11 @@ public function createFromStorageCommand($subscriptionId, $certificate, $certifi * @command-parameter-for $serviceName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Name Required. The hosted service account name to operate on. * @command-parameter-for $deploymentName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --DeploymentName Required. The name for the deployment. * @command-parameter-for $label Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Label Required. The label for the deployment. + * @command-parameter-for $packageLocation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --PackageLocation Required. The location of the .cspkg file. + * @command-parameter-for $serviceConfigurationLocation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file. + * @command-parameter-for $storageAccount Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --StorageAccount Required. Storage account to use when creating the deployment. * @command-parameter-for $staging Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Staging Host the service in the staging slot. * @command-parameter-for $production Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Production Host the service in the staging slot. - * @command-parameter-for $packageLocation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --PackageLocation Required. The location of the .cspkg file. - * @command-parameter-for $serviceConfigurationLocation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file. - * @command-parameter-for $storageAccount Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --StorageAccount Required. Storage account to use when creating the deployment. * @command-parameter-for $startImmediately Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --StartImmediately Optional. Start the deployment after creation. * @command-parameter-for $warningsAsErrors Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WarningsAsErrors Optional. Treat warnings as errors. * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete? @@ -123,7 +123,7 @@ public function createFromStorageCommand($subscriptionId, $certificate, $certifi * @command-example --ServiceConfigLocation:".\ServiceConfiguration.cscfg" --StorageAccount:"mystorage" * @command-example --StartImmediately --WaitFor */ - public function createFromLocalCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentName, $label, $staging = false, $production = false, $packageLocation, $serviceConfigurationLocation, $storageAccount, $startImmediately = true, $warningsAsErrors = false, $waitForOperation = false) + public function createFromLocalCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentName, $label, $packageLocation, $serviceConfigurationLocation, $storageAccount, $staging = false, $production = false, $startImmediately = true, $warningsAsErrors = false, $waitForOperation = false) { $deploymentSlot = 'staging'; if (!$staging && !$production) { diff --git a/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php b/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php index 071a533091..47c2f61e3b 100644 --- a/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php +++ b/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php @@ -209,12 +209,16 @@ public function getConfigurationForRoleInstance($roleInstance = null) * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply * @throws Zend_Service_WindowsAzure_Diagnostics_Exception */ - public function setConfigurationForRoleInstance($roleInstance = null, Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration) + public function setConfigurationForRoleInstance($roleInstance = null, Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration = null) { if (is_null($roleInstance)) { require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php'; throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.'); } + if (is_null($configuration)) { + require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php'; + throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Configuration should be specified.'); + } $this->_blobStorageClient->putBlobData($this->_controlContainer, $roleInstance, $configuration->toXml(), array(), null, array('Content-Type' => 'text/xml')); } diff --git a/library/Zend/Service/WindowsAzure/Storage/Batch.php b/library/Zend/Service/WindowsAzure/Storage/Batch.php index 659b726175..5e9a0b697f 100644 --- a/library/Zend/Service/WindowsAzure/Storage/Batch.php +++ b/library/Zend/Service/WindowsAzure/Storage/Batch.php @@ -105,7 +105,7 @@ protected function _clean() unset($this->_operations); $this->_storageClient->setCurrentBatch(null); $this->_storageClient = null; - unset($this); + // unset($this); } /** diff --git a/library/Zend/Service/WindowsAzure/Storage/Queue.php b/library/Zend/Service/WindowsAzure/Storage/Queue.php index 8a461761cf..43e61354dc 100644 --- a/library/Zend/Service/WindowsAzure/Storage/Queue.php +++ b/library/Zend/Service/WindowsAzure/Storage/Queue.php @@ -519,7 +519,7 @@ public function clearMessages($queueName = '') * @param Zend_Service_WindowsAzure_Storage_QueueMessage $message Message to delete from queue. A message retrieved using "peekMessages" can NOT be deleted! * @throws Zend_Service_WindowsAzure_Exception */ - public function deleteMessage($queueName = '', Zend_Service_WindowsAzure_Storage_QueueMessage $message) + public function deleteMessage($queueName = '', Zend_Service_WindowsAzure_Storage_QueueMessage $message = null) { if ($queueName === '') { require_once 'Zend/Service/WindowsAzure/Exception.php'; @@ -529,6 +529,10 @@ public function deleteMessage($queueName = '', Zend_Service_WindowsAzure_Storage require_once 'Zend/Service/WindowsAzure/Exception.php'; throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.'); } + if ($message === null) { + require_once 'Zend/Service/WindowsAzure/Exception.php'; + throw new Zend_Service_WindowsAzure_Exception('Message is not specified.'); + } if ($message->PopReceipt == '') { require_once 'Zend/Service/WindowsAzure/Exception.php'; throw new Zend_Service_WindowsAzure_Exception('A message retrieved using "peekMessages" can NOT be deleted! Use "getMessages" instead.'); diff --git a/library/Zend/Service/Yahoo/ImageResultSet.php b/library/Zend/Service/Yahoo/ImageResultSet.php index b827468321..33452bea45 100644 --- a/library/Zend/Service/Yahoo/ImageResultSet.php +++ b/library/Zend/Service/Yahoo/ImageResultSet.php @@ -56,7 +56,7 @@ class Zend_Service_Yahoo_ImageResultSet extends Zend_Service_Yahoo_ResultSet * * @return Zend_Service_Yahoo_ImageResult */ - public function current() + public function current(): Zend_Service_Yahoo_ImageResult { return new Zend_Service_Yahoo_ImageResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Service/Yahoo/InlinkDataResultSet.php b/library/Zend/Service/Yahoo/InlinkDataResultSet.php index 3a8b815d10..b79ea1050d 100644 --- a/library/Zend/Service/Yahoo/InlinkDataResultSet.php +++ b/library/Zend/Service/Yahoo/InlinkDataResultSet.php @@ -55,7 +55,7 @@ class Zend_Service_Yahoo_InlinkDataResultSet extends Zend_Service_Yahoo_ResultSe * * @return Zend_Service_Yahoo_InlinkDataResult */ - public function current() + public function current(): Zend_Service_Yahoo_InlinkDataResult { return new Zend_Service_Yahoo_InlinkDataResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Service/Yahoo/LocalResultSet.php b/library/Zend/Service/Yahoo/LocalResultSet.php index d2228244e6..11ff817e31 100644 --- a/library/Zend/Service/Yahoo/LocalResultSet.php +++ b/library/Zend/Service/Yahoo/LocalResultSet.php @@ -77,7 +77,7 @@ public function __construct(DOMDocument $dom) * * @return Zend_Service_Yahoo_LocalResult */ - public function current() + public function current(): Zend_Service_Yahoo_LocalResult { return new Zend_Service_Yahoo_LocalResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Service/Yahoo/NewsResultSet.php b/library/Zend/Service/Yahoo/NewsResultSet.php index 7f2c13120d..41aa3c50b9 100644 --- a/library/Zend/Service/Yahoo/NewsResultSet.php +++ b/library/Zend/Service/Yahoo/NewsResultSet.php @@ -56,7 +56,7 @@ class Zend_Service_Yahoo_NewsResultSet extends Zend_Service_Yahoo_ResultSet * * @return Zend_Service_Yahoo_NewsResult */ - public function current() + public function current(): Zend_Service_Yahoo_NewsResult { return new Zend_Service_Yahoo_NewsResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Service/Yahoo/PageDataResultSet.php b/library/Zend/Service/Yahoo/PageDataResultSet.php index 60cd4a576f..af17dbad11 100644 --- a/library/Zend/Service/Yahoo/PageDataResultSet.php +++ b/library/Zend/Service/Yahoo/PageDataResultSet.php @@ -53,9 +53,9 @@ class Zend_Service_Yahoo_PageDataResultSet extends Zend_Service_Yahoo_ResultSet /** * Overrides Zend_Service_Yahoo_ResultSet::current() * - * @return Zend_Service_Yahoo_WebResult + * @return Zend_Service_Yahoo_PageDataResult */ - public function current() + public function current(): Zend_Service_Yahoo_PageDataResult { return new Zend_Service_Yahoo_PageDataResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Service/Yahoo/ResultSet.php b/library/Zend/Service/Yahoo/ResultSet.php index 163cafb68b..7c7499c510 100644 --- a/library/Zend/Service/Yahoo/ResultSet.php +++ b/library/Zend/Service/Yahoo/ResultSet.php @@ -121,7 +121,7 @@ public function totalResults() * @throws Zend_Service_Exception * @return Zend_Service_Yahoo_Result */ - public function current() + public function current(): Zend_Service_Yahoo_Result { /** * @see Zend_Service_Exception @@ -137,7 +137,7 @@ public function current() * * @return int */ - public function key() + public function key(): int { return $this->_currentIndex; } @@ -148,7 +148,7 @@ public function key() * * @return void */ - public function next() + public function next(): void { $this->_currentIndex += 1; } @@ -159,7 +159,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { $this->_currentIndex = 0; } @@ -188,7 +188,7 @@ public function seek($index) * * @return boolean */ - public function valid() + public function valid(): bool { return $this->_currentIndex < $this->_results->length; } diff --git a/library/Zend/Service/Yahoo/VideoResultSet.php b/library/Zend/Service/Yahoo/VideoResultSet.php index c26ff496e5..a12113cf6a 100644 --- a/library/Zend/Service/Yahoo/VideoResultSet.php +++ b/library/Zend/Service/Yahoo/VideoResultSet.php @@ -56,7 +56,7 @@ class Zend_Service_Yahoo_VideoResultSet extends Zend_Service_Yahoo_ResultSet * * @return Zend_Service_Yahoo_VideoResult */ - public function current() + public function current(): Zend_Service_Yahoo_VideoResult { return new Zend_Service_Yahoo_VideoResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Service/Yahoo/WebResultSet.php b/library/Zend/Service/Yahoo/WebResultSet.php index 267f04b4bd..c7fc22f574 100644 --- a/library/Zend/Service/Yahoo/WebResultSet.php +++ b/library/Zend/Service/Yahoo/WebResultSet.php @@ -56,7 +56,7 @@ class Zend_Service_Yahoo_WebResultSet extends Zend_Service_Yahoo_ResultSet * * @return Zend_Service_Yahoo_WebResult */ - public function current() + public function current(): Zend_Service_Yahoo_WebResult { return new Zend_Service_Yahoo_WebResult($this->_results->item($this->_currentIndex)); } diff --git a/library/Zend/Session/Namespace.php b/library/Zend/Session/Namespace.php index 06aa272b9e..f94091ba99 100644 --- a/library/Zend/Session/Namespace.php +++ b/library/Zend/Session/Namespace.php @@ -207,7 +207,7 @@ public function __construct($namespace = 'Default', $singleInstance = false) * * @return ArrayObject - iteratable container of the namespace contents */ - public function getIterator() + public function getIterator(): ArrayObject { return new ArrayObject(parent::_namespaceGetAll($this->_namespace)); } diff --git a/library/Zend/Stdlib/PriorityQueue.php b/library/Zend/Stdlib/PriorityQueue.php index b0c30d5a5c..b2b67a7337 100644 --- a/library/Zend/Stdlib/PriorityQueue.php +++ b/library/Zend/Stdlib/PriorityQueue.php @@ -134,7 +134,7 @@ public function isEmpty() * * @return int */ - public function count() + public function count(): int { return count($this->items); } @@ -171,7 +171,7 @@ public function extract() * * @return SplPriorityQueue */ - public function getIterator() + public function getIterator(): SplPriorityQueue { $queue = $this->getQueue(); return clone $queue; diff --git a/library/Zend/Stdlib/SplPriorityQueue.php b/library/Zend/Stdlib/SplPriorityQueue.php index bf19cc7aae..b0e6d0ba6b 100644 --- a/library/Zend/Stdlib/SplPriorityQueue.php +++ b/library/Zend/Stdlib/SplPriorityQueue.php @@ -105,7 +105,7 @@ public function compare($priority1, $priority2) * * @return int */ - public function count() + public function count(): int { return $this->count; } @@ -115,7 +115,7 @@ public function count() * * @return mixed */ - public function current() + public function current(): mixed { if (!$this->preparedQueue) { $this->rewind(); @@ -227,7 +227,7 @@ public function isEmpty() * * @return mixed Usually an int or string */ - public function key() + public function key(): mixed { return $this->count; } @@ -259,7 +259,7 @@ public function recoverFromCorruption() * * @return void */ - public function rewind() + public function rewind(): void { if (!$this->preparedQueue) { $this->prepareQueue(); @@ -328,7 +328,7 @@ public function top() * * @return bool */ - public function valid() + public function valid(): bool { return (bool) $this->count; } diff --git a/library/Zend/Tag/ItemList.php b/library/Zend/Tag/ItemList.php index dfc8cddfca..856acc8455 100644 --- a/library/Zend/Tag/ItemList.php +++ b/library/Zend/Tag/ItemList.php @@ -45,7 +45,7 @@ class Zend_Tag_ItemList implements Countable, SeekableIterator, ArrayAccess * * @return integer */ - public function count() + public function count(): int { return count($this->_items); } @@ -138,7 +138,7 @@ public function seek($index) * * @return mixed */ - public function current() + public function current(): mixed { return current($this->_items); } @@ -148,6 +148,7 @@ public function current() * * @return mixed */ + #[ReturnTypeWillChange] public function next() { return next($this->_items); @@ -156,9 +157,9 @@ public function next() /** * Return the key of the current element * - * @return mixed + * @return string|int|null */ - public function key() + public function key(): string|int|null { return key($this->_items); } @@ -168,7 +169,7 @@ public function key() * * @return boolean */ - public function valid() + public function valid(): bool { return ($this->current() !== false); } @@ -178,7 +179,7 @@ public function valid() * * @return void */ - public function rewind() + public function rewind(): void { reset($this->_items); } @@ -189,7 +190,8 @@ public function rewind() * @param mixed $offset * @return boolean */ - public function offsetExists($offset) { + public function offsetExists($offset): bool + { return array_key_exists($offset, $this->_items); } @@ -197,9 +199,10 @@ public function offsetExists($offset) { * Get the value of an offset * * @param mixed $offset - * @return Zend_Tag_Taggable + * @return Zend_Tag_Taggable|null */ - public function offsetGet($offset) { + public function offsetGet($offset): ?Zend_Tag_Taggable + { return $this->_items[$offset]; } @@ -211,7 +214,8 @@ public function offsetGet($offset) { * @throws OutOfBoundsException When item does not implement Zend_Tag_Taggable * @return void */ - public function offsetSet($offset, $item) { + public function offsetSet($offset, $item): void + { // We need to make that check here, as the method signature must be // compatible with ArrayAccess::offsetSet() if (!($item instanceof Zend_Tag_Taggable)) { @@ -232,7 +236,8 @@ public function offsetSet($offset, $item) { * @param mixed $offset * @return void */ - public function offsetUnset($offset) { + public function offsetUnset($offset): void + { unset($this->_items[$offset]); } } diff --git a/library/Zend/TimeSync.php b/library/Zend/TimeSync.php index bf56fe25a0..5bc5360ce0 100644 --- a/library/Zend/TimeSync.php +++ b/library/Zend/TimeSync.php @@ -93,7 +93,7 @@ public function __construct($target = null, $alias = null) * * @return ArrayObject */ - public function getIterator() + public function getIterator(): ArrayObject { return new ArrayObject($this->_timeservers); } diff --git a/library/Zend/Tool/Framework/Action/Repository.php b/library/Zend/Tool/Framework/Action/Repository.php index 38262c01e2..82f86acbaf 100644 --- a/library/Zend/Tool/Framework/Action/Repository.php +++ b/library/Zend/Tool/Framework/Action/Repository.php @@ -120,7 +120,7 @@ public function getAction($actionName) * * @return int */ - public function count() + public function count(): int { return count($this->_actions); } @@ -130,7 +130,7 @@ public function count() * * @return array */ - public function getIterator() + public function getIterator(): ArrayIterator { return new ArrayIterator($this->_actions); } diff --git a/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php b/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php index 50c9c74095..943204ee9b 100644 --- a/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php +++ b/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php @@ -49,9 +49,9 @@ public function __construct(RecursiveIterator $iterator, $denyDirectoryPattern = /** * accept() - Which iterable items to accept or deny, required by FilterInterface * - * @return unknown + * @return bool */ - public function accept() + public function accept(): bool { $currentNode = $this->current(); $currentNodeRealPath = $currentNode->getRealPath(); @@ -74,7 +74,7 @@ public function accept() * * @return Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator */ - public function getChildren() + public function getChildren(): Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator { if (empty($this->ref)) { $this->ref = new ReflectionClass($this); diff --git a/library/Zend/Tool/Framework/Manifest/Repository.php b/library/Zend/Tool/Framework/Manifest/Repository.php index 31aa4e4ed6..89f9c7f602 100644 --- a/library/Zend/Tool/Framework/Manifest/Repository.php +++ b/library/Zend/Tool/Framework/Manifest/Repository.php @@ -295,7 +295,7 @@ public function __toString() * * @return int */ - public function count() + public function count(): int { return count($this->_metadatas); } @@ -305,7 +305,7 @@ public function count() * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): ArrayIterator { return new ArrayIterator($this->_metadatas); } diff --git a/library/Zend/Tool/Framework/Provider/Repository.php b/library/Zend/Tool/Framework/Provider/Repository.php index b5aa53d35a..7f7172ef6d 100644 --- a/library/Zend/Tool/Framework/Provider/Repository.php +++ b/library/Zend/Tool/Framework/Provider/Repository.php @@ -238,7 +238,7 @@ public function getProviderSignature($providerName) * * @return int */ - public function count() + public function count(): int { return count($this->_providers); } @@ -248,7 +248,7 @@ public function count() * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): ArrayIterator { return new ArrayIterator($this->getProviders()); } diff --git a/library/Zend/Tool/Project/Context/Repository.php b/library/Zend/Tool/Project/Context/Repository.php index 8a9d8f4c18..f4d0aae8dd 100644 --- a/library/Zend/Tool/Project/Context/Repository.php +++ b/library/Zend/Tool/Project/Context/Repository.php @@ -176,7 +176,7 @@ public function isOverwritableContext($name) return $this->_contexts[$index]['isOverwritable']; } - public function count() + public function count(): int { return count($this->_contexts); } 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/Tool/Project/Profile.php b/library/Zend/Tool/Project/Profile.php index 6429e3e816..2fa945cd6c 100644 --- a/library/Zend/Tool/Project/Profile.php +++ b/library/Zend/Tool/Project/Profile.php @@ -80,7 +80,7 @@ public function setOptions(Array $options) * * @return RecursiveIteratorIterator */ - public function getIterator() + public function getIterator(): RecursiveIteratorIterator { require_once 'Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php'; diff --git a/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php b/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php index b074614e43..c55e749764 100644 --- a/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php +++ b/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php @@ -165,7 +165,7 @@ public function setDenyNames($denyNames) * * @return bool */ - public function accept() + public function accept(): bool { $currentItem = $this->current(); @@ -196,9 +196,9 @@ public function accept() * This is here due to a bug/design issue in PHP * @link * - * @return unknown + * @return RecursiveFilterIterator|null */ - function getChildren() + function getChildren(): ?RecursiveFilterIterator { if (empty($this->ref)) { diff --git a/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php b/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php index 65b46b6ff3..1e5f35021f 100644 --- a/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php +++ b/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php @@ -36,7 +36,7 @@ class Zend_Tool_Project_Profile_Iterator_EnabledResourceFilter extends Recursive * * @return bool */ - public function accept() + public function accept(): bool { return $this->current()->isEnabled(); } diff --git a/library/Zend/Tool/Project/Profile/Resource/Container.php b/library/Zend/Tool/Project/Profile/Resource/Container.php index 4f06f6f55d..b8f5ad870e 100644 --- a/library/Zend/Tool/Project/Profile/Resource/Container.php +++ b/library/Zend/Tool/Project/Profile/Resource/Container.php @@ -329,9 +329,9 @@ public function append(Zend_Tool_Project_Profile_Resource_Container $resource) /** * current() - required by RecursiveIterator * - * @return Zend_Tool_Project_Profile_Resource + * @return Zend_Tool_Project_Profile_Resource|false */ - public function current() + public function current(): Zend_Tool_Project_Profile_Resource|false { return current($this->_subResources); } @@ -339,9 +339,9 @@ public function current() /** * key() - required by RecursiveIterator * - * @return int + * @return int|null */ - public function key() + public function key(): ?int { return key($this->_subResources); } @@ -351,6 +351,7 @@ public function key() * * @return bool */ + #[ReturnTypeWillChange] public function next() { return next($this->_subResources); @@ -361,6 +362,7 @@ public function next() * * @return bool */ + #[ReturnTypeWillChange] public function rewind() { return reset($this->_subResources); @@ -371,7 +373,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { return (bool) $this->current(); } @@ -389,9 +391,9 @@ public function hasChildren() /** * getChildren() * - * @return array + * @return RecursiveIterator|null */ - public function getChildren() + public function getChildren(): ?RecursiveIterator { return $this->current(); } @@ -401,7 +403,7 @@ public function getChildren() * * @return int */ - public function count() + public function count(): int { return count($this->_subResources); } diff --git a/library/Zend/Validate/Abstract.php b/library/Zend/Validate/Abstract.php index 87998c576a..4b2fe7614d 100644 --- a/library/Zend/Validate/Abstract.php +++ b/library/Zend/Validate/Abstract.php @@ -32,6 +32,8 @@ */ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface { + public ?bool $zfBreakChainOnFailure = null; + /** * The value to be validated * diff --git a/library/Zend/Validate/EmailAddress.php b/library/Zend/Validate/EmailAddress.php index 8bffcaec39..53e6f277d7 100644 --- a/library/Zend/Validate/EmailAddress.php +++ b/library/Zend/Validate/EmailAddress.php @@ -453,7 +453,7 @@ private function _validateMXRecords() //decode IDN domain name if possible if (function_exists('idn_to_ascii')) { - $hostname = idn_to_ascii($this->_hostname); + $hostname = idn_to_ascii($this->_hostname, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); } $result = getmxrr($hostname, $mxHosts); diff --git a/library/Zend/Validate/File/Extension.php b/library/Zend/Validate/File/Extension.php index 92f9f06a87..4e44fd57bb 100644 --- a/library/Zend/Validate/File/Extension.php +++ b/library/Zend/Validate/File/Extension.php @@ -121,7 +121,7 @@ public function setCase($case) */ public function getExtension() { - $extension = explode(',', $this->_extension); + $extension = explode(',', strval($this->_extension)); return $extension; } diff --git a/library/Zend/Validate/File/Upload.php b/library/Zend/Validate/File/Upload.php index 5eae769846..b7163d2d67 100644 --- a/library/Zend/Validate/File/Upload.php +++ b/library/Zend/Validate/File/Upload.php @@ -161,7 +161,7 @@ public function setFiles($files = array()) */ public function isValid($value, $file = null) { - $this->_messages = null; + $this->_messages = array(); if (array_key_exists($value, $this->_files)) { $files[$value] = $this->_files[$value]; } else { diff --git a/library/Zend/Validate/Isbn.php b/library/Zend/Validate/Isbn.php index 86c0c5c496..4d100aa573 100644 --- a/library/Zend/Validate/Isbn.php +++ b/library/Zend/Validate/Isbn.php @@ -167,7 +167,7 @@ public function isValid($value) $isbn10 = str_replace($this->_separator, '', $value); $sum = 0; for ($i = 0; $i < 9; $i++) { - $sum += (10 - $i) * $isbn10{$i}; + $sum += (10 - $i) * $isbn10[$i]; } // checksum @@ -185,9 +185,9 @@ public function isValid($value) $sum = 0; for ($i = 0; $i < 12; $i++) { if ($i % 2 == 0) { - $sum += $isbn13{$i}; + $sum += $isbn13[$i]; } else { - $sum += 3 * $isbn13{$i}; + $sum += 3 * $isbn13[$i]; } } // checksum diff --git a/library/Zend/View/Abstract.php b/library/Zend/View/Abstract.php index ffcefee19b..d49bd69bf3 100644 --- a/library/Zend/View/Abstract.php +++ b/library/Zend/View/Abstract.php @@ -36,6 +36,7 @@ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ +#[AllowDynamicProperties] abstract class Zend_View_Abstract implements Zend_View_Interface { /** @@ -902,7 +903,7 @@ public function render($name) public function escape($var) { if (in_array($this->_escape, array('htmlspecialchars', 'htmlentities'))) { - return call_user_func($this->_escape, $var, ENT_COMPAT, $this->_encoding); + return call_user_func($this->_escape, strval($var), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, $this->_encoding); } if (1 == func_num_args()) { diff --git a/library/Zend/View/Helper/BaseUrl.php b/library/Zend/View/Helper/BaseUrl.php index 8af36bbdda..391a4d680f 100644 --- a/library/Zend/View/Helper/BaseUrl.php +++ b/library/Zend/View/Helper/BaseUrl.php @@ -69,7 +69,7 @@ public function baseUrl($file = null) */ public function setBaseUrl($base) { - $this->_baseUrl = rtrim($base, '/\\'); + $this->_baseUrl = rtrim(strval($base), '/\\'); return $this; } @@ -107,7 +107,7 @@ protected function _removeScriptName($url) return $url; } - if (($pos = strripos($url, basename($_SERVER['SCRIPT_NAME']))) !== false) { + if (($pos = strripos(strval($url), basename($_SERVER['SCRIPT_NAME']))) !== false) { $url = substr($url, 0, $pos); } diff --git a/library/Zend/View/Helper/Cycle.php b/library/Zend/View/Helper/Cycle.php index eb5fd5132b..0c213eeded 100644 --- a/library/Zend/View/Helper/Cycle.php +++ b/library/Zend/View/Helper/Cycle.php @@ -154,6 +154,7 @@ public function __toString() * * @return Zend_View_Helper_Cycle */ + #[ReturnTypeWillChange] public function next() { $count = count($this->_data[$this->_name]); @@ -184,7 +185,7 @@ public function prev() * * @return int */ - public function key() + public function key(): int { if ($this->_pointers[$this->_name] < 0) return 0; @@ -197,6 +198,7 @@ public function key() * * @return Zend_View_Helper_Cycle */ + #[ReturnTypeWillChange] public function rewind() { $this->_pointers[$this->_name] = -1; @@ -208,7 +210,7 @@ public function rewind() * * @return bool */ - public function valid() + public function valid(): bool { return isset($this->_data[$this->_name][$this->key()]); } @@ -218,7 +220,7 @@ public function valid() * * @return mixed */ - public function current() + public function current(): mixed { return $this->_data[$this->_name][$this->key()]; } diff --git a/library/Zend/View/Helper/HeadLink.php b/library/Zend/View/Helper/HeadLink.php index 61bf0a29d3..1c7c48b75b 100644 --- a/library/Zend/View/Helper/HeadLink.php +++ b/library/Zend/View/Helper/HeadLink.php @@ -396,7 +396,8 @@ public function createDataStylesheet(array $args) } } - if(0 < count($args) && is_array($args[0])) { + $extras = array(); + if (0 < count($args) && is_array($args[0])) { $extras = array_shift($args); $extras = (array) $extras; } @@ -441,6 +442,7 @@ public function createDataAlternate(array $args) $type = array_shift($args); $title = array_shift($args); + $extras = array(); if(0 < count($args) && is_array($args[0])) { $extras = array_shift($args); $extras = (array) $extras; 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/View/Helper/Placeholder/Container/Standalone.php b/library/Zend/View/Helper/Placeholder/Container/Standalone.php index deeca4de31..7b0a3e2420 100644 --- a/library/Zend/View/Helper/Placeholder/Container/Standalone.php +++ b/library/Zend/View/Helper/Placeholder/Container/Standalone.php @@ -261,7 +261,7 @@ public function __toString() * * @return int */ - public function count() + public function count(): int { $container = $this->getContainer(); return count($container); @@ -273,7 +273,7 @@ public function count() * @param string|int $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return $this->getContainer()->offsetExists($offset); } @@ -284,7 +284,7 @@ public function offsetExists($offset) * @param string|int $offset * @return mixed */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->getContainer()->offsetGet($offset); } @@ -296,6 +296,7 @@ public function offsetGet($offset) * @param mixed $value * @return void */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { return $this->getContainer()->offsetSet($offset, $value); @@ -307,6 +308,7 @@ public function offsetSet($offset, $value) * @param string|int $offset * @return void */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { return $this->getContainer()->offsetUnset($offset); @@ -317,7 +319,7 @@ public function offsetUnset($offset) * * @return Iterator */ - public function getIterator() + public function getIterator(): Iterator { return $this->getContainer()->getIterator(); } diff --git a/library/Zend/Wildfire/Plugin/FirePhp.php b/library/Zend/Wildfire/Plugin/FirePhp.php index 416d2057ee..5dc4be6cf1 100644 --- a/library/Zend/Wildfire/Plugin/FirePhp.php +++ b/library/Zend/Wildfire/Plugin/FirePhp.php @@ -737,7 +737,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]; } diff --git a/library/Zend/Xml/Security.php b/library/Zend/Xml/Security.php index d95d4f81ef..efa4b674cc 100644 --- a/library/Zend/Xml/Security.php +++ b/library/Zend/Xml/Security.php @@ -83,7 +83,9 @@ public static function scan($xml, DOMDocument $dom = null) } if (!self::isPhpFpm()) { - $loadEntities = libxml_disable_entity_loader(true); + if (\LIBXML_VERSION < 20900) { + $loadEntities = libxml_disable_entity_loader(true); + } $useInternalXmlErrors = libxml_use_internal_errors(true); } @@ -97,7 +99,9 @@ public static function scan($xml, DOMDocument $dom = null) if (!$result) { // Entity load to previous setting if (!self::isPhpFpm()) { - libxml_disable_entity_loader($loadEntities); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader($loadEntities); + } libxml_use_internal_errors($useInternalXmlErrors); } return false; @@ -117,7 +121,9 @@ public static function scan($xml, DOMDocument $dom = null) // Entity load to previous setting if (!self::isPhpFpm()) { - libxml_disable_entity_loader($loadEntities); + if (\LIBXML_VERSION < 20900) { + libxml_disable_entity_loader($loadEntities); + } libxml_use_internal_errors($useInternalXmlErrors); } @@ -169,7 +175,7 @@ public static function isPhpFpm() $isVulnerableVersion = ( version_compare(PHP_VERSION, '5.5.22', 'lt') || ( - version_compare(PHP_VERSION, '5.6', 'gte') + version_compare(PHP_VERSION, '5.6', 'ge') && version_compare(PHP_VERSION, '5.6.6', 'lt') ) ); diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000000..ae6eb16c58 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + + ./tests/Zend + + + + + + + + diff --git a/tests/TestHelper.php b/tests/TestHelper.php index 3167a43d56..6a5f1af7b6 100644 --- a/tests/TestHelper.php +++ b/tests/TestHelper.php @@ -20,20 +20,6 @@ * @version $Id$ */ -/** - * Include PHPUnit dependencies - */ -if (version_compare(PHPUnit_Runner_Version::id(), '4.0.0', '<')) { - require_once 'PHPUnit/Runner/Version.php'; - - $phpunitVersion = PHPUnit_Runner_Version::id(); - if ($phpunitVersion == '@package_version@' || version_compare($phpunitVersion, '3.5.5', '>=')) { - require_once 'PHPUnit/Autoload.php'; // >= PHPUnit 3.5.5 - } else { - require_once 'PHPUnit/Framework.php'; // < PHPUnit 3.5.5 - } -} - /* * Set error reporting to the level to which Zend Framework code must comply. */ @@ -85,3 +71,4 @@ // Suppress DateTime warnings date_default_timezone_set(@date_default_timezone_get()); +define('PHPUnit_MAIN_METHOD', false); diff --git a/tests/Zend/CodeGenerator/Php/FileTest.php b/tests/Zend/CodeGenerator/Php/FileTest.php index 7e57764bd6..1e4fdf577d 100644 --- a/tests/Zend/CodeGenerator/Php/FileTest.php +++ b/tests/Zend/CodeGenerator/Php/FileTest.php @@ -287,7 +287,7 @@ public function testFileLineEndingsAreAlwaysLineFeed() $targetLength = strlen('require_once \'SampleClass.php\';'); $this->assertEquals($targetLength, strlen($lines[2])); - $this->assertEquals(';', $lines[2]{$targetLength-1}); + $this->assertEquals(';', $lines[2][$targetLength-1]); } /** diff --git a/tests/Zend/Controller/Router/Route/ChainTest.php b/tests/Zend/Controller/Router/Route/ChainTest.php index 95134cb104..9fe2a71132 100644 --- a/tests/Zend/Controller/Router/Route/ChainTest.php +++ b/tests/Zend/Controller/Router/Route/ChainTest.php @@ -1040,7 +1040,7 @@ public function getVersion() return 2; } - public function assemble($data = array(), $reset = false, $encode = false) + public function assemble($data = array(), $reset = false, $encode = false, $partial = false) {} public static function getInstance(Zend_Config $config) diff --git a/tests/Zend/Dojo/DataTest.php b/tests/Zend/Dojo/DataTest.php index f766692ff7..bd3dc6da5b 100644 --- a/tests/Zend/Dojo/DataTest.php +++ b/tests/Zend/Dojo/DataTest.php @@ -554,27 +554,29 @@ public function __construct() } } - public function current() + public function current(): mixed { return current($this->items); } - public function key() + public function key(): string|int|null { return key($this->items); } + #[ReturnTypeWillChange] public function next() { return next($this->items); } + #[ReturnTypeWillChange] public function rewind() { return reset($this->items); } - public function valid() + public function valid(): bool { return (bool) $this->current(); } diff --git a/tests/Zend/JsonTest.php b/tests/Zend/JsonTest.php index 711bc65223..eddcc0494c 100644 --- a/tests/Zend/JsonTest.php +++ b/tests/Zend/JsonTest.php @@ -1043,7 +1043,8 @@ class ZF12347_IteratorAggregate implements IteratorAggregate 'baz' => 5 ); - public function getIterator() { + public function getIterator(): ArrayIterator + { return new ArrayIterator($this->array); } } diff --git a/tests/Zend/Loader/TestAsset/TestPluginMap.php b/tests/Zend/Loader/TestAsset/TestPluginMap.php index f837d88a68..378298324c 100644 --- a/tests/Zend/Loader/TestAsset/TestPluginMap.php +++ b/tests/Zend/Loader/TestAsset/TestPluginMap.php @@ -46,7 +46,7 @@ class ZendTest_Loader_TestAsset_TestPluginMap implements IteratorAggregate * * @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->map); } diff --git a/tests/Zend/Paginator/_files/Zf4207.php b/tests/Zend/Paginator/_files/Zf4207.php index 9058c76c71..b8bafbf7d2 100644 --- a/tests/Zend/Paginator/_files/Zf4207.php +++ b/tests/Zend/Paginator/_files/Zf4207.php @@ -31,7 +31,7 @@ */ class Zf4207 extends ArrayObject implements Zend_Paginator_Adapter_Interface { - public function count() + public function count(): int { return 10; } diff --git a/tests/Zend/Queue/Custom/Messages.php b/tests/Zend/Queue/Custom/Messages.php index 03a1659571..586998b37e 100644 --- a/tests/Zend/Queue/Custom/Messages.php +++ b/tests/Zend/Queue/Custom/Messages.php @@ -120,6 +120,7 @@ public function append($value) { /** * @see SPL ArrayAccess::offsetSet */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { if (! $value instanceof Custom_Message) { $msg = '$value must be a child or an instance of Custom_Messag'; @@ -137,14 +138,16 @@ public function offsetSet($offset, $value) { /** * @see SPL ArrayAccess::offsetGet */ - public function offsetGet($offset) { + public function offsetGet($offset): mixed + { return $this->_data[$offset]; } /** * @see SPL ArrayAccess::offsetUnset */ - public function offsetUnset($offset) { + public function offsetUnset($offset): void + { if (! $this->_connected) { $msg = 'Cannot delete message after serialization'; /** @@ -161,7 +164,8 @@ public function offsetUnset($offset) { /** * @see SPL ArrayAccess::offsetExists */ - public function offsetExists($offset) { + public function offsetExists($offset): bool + { return isSet($this->_data[$offset]); } diff --git a/tests/Zend/Queue/Stomp/ClientTest.php b/tests/Zend/Queue/Stomp/ClientTest.php index 38faa8db6a..36d2347aaa 100644 --- a/tests/Zend/Queue/Stomp/ClientTest.php +++ b/tests/Zend/Queue/Stomp/ClientTest.php @@ -54,7 +54,7 @@ class Zend_Queue_Stomp_Connection_Mock * @param array $config ('scheme', 'host', 'port') * @return true; */ - public function open($scheme, $host, $port) + public function open($scheme, $host, $port, array $options = array()) { if ( $port == 0 ) return false; return true; diff --git a/tests/Zend/Reflection/_files/FunctionWithEmbeddedVariableInString.php b/tests/Zend/Reflection/_files/FunctionWithEmbeddedVariableInString.php index dd6b7c2a27..d2989b0045 100644 --- a/tests/Zend/Reflection/_files/FunctionWithEmbeddedVariableInString.php +++ b/tests/Zend/Reflection/_files/FunctionWithEmbeddedVariableInString.php @@ -2,10 +2,10 @@ function firstOne() { $substitute = "Testing"; - $varA = "${substitute} 123!"; + $varA = "{$substitute} 123!"; $varB = "{$substitute} 123!"; $varC = "$substitute 123!"; - $varD = "${substitute}"; + $varD = "{$substitute}"; } function secondOne() {} diff --git a/tests/Zend/Reflection/_files/TestSampleClass.php b/tests/Zend/Reflection/_files/TestSampleClass.php index 7533976a8d..98c199c9e7 100644 --- a/tests/Zend/Reflection/_files/TestSampleClass.php +++ b/tests/Zend/Reflection/_files/TestSampleClass.php @@ -44,9 +44,9 @@ public function getProp2($param1, Zend_Reflection_TestSampleClass $param2) return $this->_prop2; } - public function getIterator() + public function getIterator(): Traversable { - return array(); + return new ArrayObject(); } } diff --git a/tests/Zend/View/Helper/PartialLoopTest.php b/tests/Zend/View/Helper/PartialLoopTest.php index 076ecda33f..44268c696a 100644 --- a/tests/Zend/View/Helper/PartialLoopTest.php +++ b/tests/Zend/View/Helper/PartialLoopTest.php @@ -411,27 +411,29 @@ public function __construct(array $array) $this->items = $array; } - public function current() + public function current(): mixed { return current($this->items); } - public function key() + public function key(): string|int|null { return key($this->items); } + #[ReturnTypeWillChange] public function next() { return next($this->items); } + #[ReturnTypeWillChange] public function rewind() { return reset($this->items); } - public function valid() + public function valid(): bool { return (current($this->items) !== false); } @@ -457,27 +459,29 @@ public function addItem(Iterator $iterator) return $this; } - public function current() + public function current(): mixed { return current($this->items); } - public function key() + public function key(): string|int|null { return key($this->items); } + #[ReturnTypeWillChange] public function next() { return next($this->items); } + #[ReturnTypeWillChange] public function rewind() { return reset($this->items); } - public function valid() + public function valid(): bool { return (current($this->items) !== false); } @@ -514,27 +518,29 @@ public function toArray() return $this->items; } - public function current() + public function current(): mixed { return current($this->items); } - public function key() + public function key(): string|int|null { return key($this->items); } + #[ReturnTypeWillChange] public function next() { return next($this->items); } + #[ReturnTypeWillChange] public function rewind() { return reset($this->items); } - public function valid() + public function valid(): bool { return (current($this->items) !== false); }