From a571fa29dcc54c11a48538b973714b69deef7026 Mon Sep 17 00:00:00 2001 From: hungtd Date: Tue, 15 Nov 2022 12:02:53 +0700 Subject: [PATCH] Fix str_split('') logic to keep same as PHP before 8.2 on PHP 8.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reference: - https://php.watch/versions/8.2/str_split-empty-string-empty-array Fixes: - https://github.com/Shardj/zf1-future/issues/276 Signed-off-by: Elan Ruusamäe Co-authored-by: Elan Ruusamäe --- packages/zend-console-getopt/library/Zend/Console/Getopt.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/zend-console-getopt/library/Zend/Console/Getopt.php b/packages/zend-console-getopt/library/Zend/Console/Getopt.php index 7fe125dec..7632936e7 100644 --- a/packages/zend-console-getopt/library/Zend/Console/Getopt.php +++ b/packages/zend-console-getopt/library/Zend/Console/Getopt.php @@ -784,7 +784,8 @@ protected function _parseLongOption(&$argv) protected function _parseShortOptionCluster(&$argv) { $flagCluster = ltrim(array_shift($argv), '-'); - foreach (str_split($flagCluster) as $flag) { + $listFlagChar = $flagCluster === '' ? array('') : str_split($flagCluster); + foreach ($listFlagChar as $flag) { $this->_parseSingleOption($flag, $argv); } }