Skip to content

Commit

Permalink
Merge pull request #364 from develart-projects/versionAndMinorFixes
Browse files Browse the repository at this point in the history
Version and minor fixes
  • Loading branch information
develart-projects authored Aug 10, 2023
2 parents 6ff9af2 + 1bc6de3 commit aa077dd
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "shardj/zf1-future",
"description": "Zend Framework 1. The aim is to keep ZF1 working with the latest PHP versions",
"type": "library",
"version": "1.23.0",
"keywords": [
"framework",
"zf1"
Expand Down
24 changes: 20 additions & 4 deletions library/Zend/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,22 @@ private function _calculate($calc, $date, $part, $locale)

// date strings
case self::ISO_8601:

/////////////////////////////////////////////////
//first validate minimal lengts of given formats

// do we have enough of a date? minimum is Y-MM-dd
if( strpos($date, '-') !== FALSE && strlen($date) <9) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date);
}

if( strpos($date, '-') === FALSE && strlen($date) <6) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date);
}


// (-)YYYY-MM-dd
preg_match('/^(-{0,1}\d{4})-(\d{2})-(\d{2})/', $date, $datematch);
// (-)YY-MM-dd
Expand Down Expand Up @@ -1954,10 +1970,10 @@ private function _calculate($calc, $date, $part, $locale)
if (empty($timematch)) {
preg_match('/[T,\s]{0,1}(\d{2})(\d{2})/', $tmpdate, $timematch);
}
if (empty($datematch) && empty($timematch)) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date);
}
if (empty($datematch) && empty($timematch)) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date);
}

This comment has been minimized.

Copy link
@holtkamp

holtkamp Aug 11, 2023

Some indention changes going on here?

if (!empty($timematch)) {
$timeMatchCharCount = iconv_strlen($timematch[0], 'UTF-8');
$tmpdate = iconv_substr($tmpdate,
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Http/Client/Adapter/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public function setConfig($config = [])
* @param string $host
* @param int $port
* @param boolean $secure
* @param int $timeout
* @throws Zend_Http_Client_Adapter_Exception
*/
public function connect($host, $port = 80, $secure = false)
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Validate/File/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function setCase($case)
*/
public function getExtension()
{
return $this->_extension !== null
return empty($this->_extension) === FALSE
? explode(',', $this->_extension)
: [];
}
Expand All @@ -134,7 +134,7 @@ public function getExtension()
*/
public function setExtension($extension)
{
$this->_extension = null;
$this->_extension = '';
$this->addExtension($extension);
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class Zend_Version
/**
* Zend Framework version identification - see compareVersion()
*/
const VERSION = '1.22.0';
const VERSION = '1.23.0';

/**
* The latest stable version Zend Framework available
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testVersionCompare()
$expect = -1;
// unit test breaks if ZF version > 1.x
for ($i = 0; $i <= 1; $i++) {
for ($j = 0; $j <= 22; $j++) {
for ($j = 0; $j <= 99; $j++) {

This comment has been minimized.

Copy link
@boenrobot

boenrobot Aug 14, 2023

FYI, this huge increase significantly slows down unit tests.

for ($k = 0; $k <= 99; $k++) {
foreach (['dev', 'pr', 'PR', 'alpha', 'a1', 'a2', 'beta', 'b1', 'b2', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl1', 'PL1'] as $rel) {
$ver = "$i.$j.$k$rel";
Expand Down

0 comments on commit aa077dd

Please sign in to comment.