Skip to content

Commit

Permalink
Merge pull request #2 from Shardj/master
Browse files Browse the repository at this point in the history
Realign
  • Loading branch information
mattimatti authored Aug 24, 2024
2 parents 93feaea + 94d85ab commit 1cefa67
Show file tree
Hide file tree
Showing 1,330 changed files with 4,609 additions and 3,985 deletions.
67 changes: 56 additions & 11 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHPUnit-9
name: PHPUnit

on: [push, pull_request]

Expand All @@ -9,7 +9,6 @@ jobs:
runs-on: ubuntu-22.04

env:
PHP_EXTENSIONS: none, posix, curl, dom, json, libxml, mbstring, openssl, tokenizer, xml, xmlwriter, ctype, iconv, simplexml, pdo_sqlite, pdo_mysql, fileinfo, json, zip, sqlite, soap, bcmath, mcrypt, igbinary, gd, bz2, lzf, rar, memcached, memcache
PHP_INI_VALUES: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On

TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED: true
Expand All @@ -34,7 +33,9 @@ jobs:
TESTS_ZEND_CACHE_LIBMEMCACHED_HOST: 127.0.0.1
TESTS_ZEND_CACHE_LIBMEMCACHED_PORT: 11211

# https://hub.docker.com/r/bitnami/openldap
TESTS_ZEND_CACHE_APC_ENABLED: true

# https://hub.docker.com/r/bitnami/openldap
LDAP_ROOT: "dc=example,dc=com"
LDAP_ALLOW_ANON_BINDING: false
LDAP_SKIP_DEFAULT_TREE: "yes"
Expand All @@ -46,6 +47,7 @@ jobs:
TESTS_ZEND_AUTH_ADAPTER_LDAP_ONLINE_ENABLED: true

LOCALES: "fr_FR@euro fr_FR fr_BE.UTF-8 de en_US"
OPENSSL_CONF: "./tests/openssl.conf"
services:
memcache:
image: memcached:1.6.17-alpine
Expand All @@ -60,7 +62,7 @@ jobs:
MYSQL_DATABASE: ${{ env.TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE }}
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
- 3306:3306
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
Expand Down Expand Up @@ -99,13 +101,28 @@ jobs:
fail-fast: false
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
experimental:
- false
include:
#bare for PHP >=7.2
- php-extensions-bare: "none, iconv, json, libxml, xml, dom, simplexml, xmlwriter, tokenizer, mbstring"
#full for PHP <= 8.0
- php-extensions-full: "none, iconv, json, libxml, xml, dom, simplexml, xmlwriter, tokenizer, mbstring, apcu, ctype, openssl, curl, gd, posix, pdo_sqlite, pdo_mysql, fileinfo, zip, sqlite, soap, bcmath, igbinary, bz2, lzf, memcached, memcache, ldap, sqlite, mcrypt, rar"
- php-version: "7.1"
php-extensions-bare: "none, iconv, json, libxml, xml, dom, simplexml, xmlwriter, tokenizer"
- php-version: "8.1"
php-extensions-full: "none, iconv, json, libxml, xml, dom, simplexml, xmlwriter, tokenizer, mbstring, apcu, ctype, openssl, curl, gd, posix, pdo_sqlite, pdo_mysql, fileinfo, zip, sqlite, soap, bcmath, igbinary, bz2, lzf, memcached, memcache, ldap, sqlite, mcrypt"
- php-version: "8.2"
php-extensions-full: "none, iconv, json, libxml, xml, dom, simplexml, xmlwriter, tokenizer, mbstring, apcu, ctype, openssl, curl, gd, posix, pdo_sqlite, pdo_mysql, fileinfo, zip, sqlite, soap, bcmath, igbinary, bz2, lzf, memcached, memcache, ldap, sqlite, mcrypt"
- php-version: "8.3"
php-extensions-full: "none, iconv, json, libxml, xml, dom, simplexml, xmlwriter, tokenizer, mbstring, apcu, ctype, openssl, curl, gd, posix, pdo_sqlite, pdo_mysql, fileinfo, zip, sqlite, soap, bcmath, igbinary, bz2, lzf, memcached, memcache, ldap, sqlite"
experimental: true

steps:
Expand All @@ -118,32 +135,60 @@ jobs:
echo "All languages..."
locale -a
- name: Provider config base on env for intergrate test
- name: Provider config base on env for integrate test
run: cp tests/TestConfiguration.env.php tests/TestConfiguration.php

- name: Install PHP with extensions
- name: Install PHP with minimal extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: cs2pr
extensions: memcached, memcache
extensions: ${{ matrix.php-extensions-bare }}
ini-values: ${{ env.PHP_INI_VALUES }}
env:
# https://github.com/shivammathur/setup-php/issues/407#issuecomment-773675741
fail-fast: true

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
run: composer install --prefer-dist --no-progress --no-interaction

- name: Lint PHP source files
run: |
bin/parallel-lint --exclude vendor --exclude tests/Zend/Loader/_files/ParseError.php . --checkstyle | cs2pr
- name: "Run tests on PHP ${{ matrix.php-version }} (Experimental: ${{ matrix.experimental }}) with minimal extensions"
run: |
bin/phpunit -c tests/phpunit.xml
continue-on-error: ${{ matrix.experimental }}

- name: Setup LDAP
run: |
sudo apt-get install -y libnss-ldap libpam-ldap ldap-utils
tests/resources/openldap/docker-entrypoint-initdb.d/init.sh
- name: "Run tests on PHP ${{ matrix.php-version }} (Experimental: ${{ matrix.experimental }})"
run: bin/phpunit -c tests/phpunit.xml
continue-on-error: ${{ matrix.experimental }}
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: cs2pr
extensions: ${{ matrix.php-extensions-full }}
ini-values: ${{ env.PHP_INI_VALUES }}, apc.enable_cli=1
env:
# https://github.com/shivammathur/setup-php/issues/407#issuecomment-773675741
fail-fast: true

- name: "Run tests on PHP ${{ matrix.php-version }} (Experimental: ${{ matrix.experimental }}) with extensions"
run: |
bin/phpunit -c tests/phpunit.xml
continue-on-error: ${{ matrix.experimental }}
9 changes: 9 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
![zf1-future logo](https://imgur.com/S0i6qOh.png)
<sub><sup>Thanks to [WebTigers](https://github.com/WebTigers) for the logo</sup></sub>

#AIM of this doc.
As pressure to implement some PHP 8.2+ related changes are raising, we are goig to track any possible breaking change, starting from version 1.24.0

### 1.24.0
* some depracation messages have been suppresses for 8.1, but reverted: https://github.com/Shardj/zf1-future/issues/377

78 changes: 78 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,84 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.24.0] - 2024-02-05
- introduced BREAKING CHANGES doc.

### Added
- support "samesite" cookie attribute in Zend_Http_Header_SetCookie in https://github.com/Shardj/zf1-future/issues/315
- Support X-Forwarded-Proto header in https://github.com/Shardj/zf1-future/pull/386
- added setting to disable automatic strigify of pdo mysql in https://github.com/Shardj/zf1-future/pull/378

### Fixed
- reverted Deprecated : Return type on Zend_Session_SaveHandler_DbTable in https://github.com/Shardj/zf1-future/issues/377
- Zend_Db_Adapter_Db2 limit does not work in https://github.com/Shardj/zf1-future/issues/391
- Zend_Http_Client-Adapter_Socket - check transfer-encoding header is a string (and not an array) in https://github.com/Shardj/zf1-future/pull/396
- Fixes A non-numeric value encountered in PhpMath.php in https://github.com/Shardj/zf1-future/pull/402
- Updated DocBlocks to return $this for fluent interface in https://github.com/Shardj/zf1-future/pull/390
- add "array" as allowed type of $value in https://github.com/Shardj/zf1-future/pull/387
- Avoid undefined array key access inside url assembly in https://github.com/Shardj/zf1-future/pull/383
- Fixed #357 return type backward-compatible issue reported in https://github.com/Shardj/zf1-future/pull/379
- Fixed missing property in https://github.com/Shardj/zf1-future/pull/376


## [1.23.5] - 2023-08-24
### Fixed
- further Zend Mail sendmail transport validation tweak

## [1.23.4] - 2023-08-24
### Fixed
- corrected Zend Mail sendmail transport comparison

## [1.23.3] - 2023-08-23
### Added
- Enabled testing of APCU for all PHP versions when running with all extensions enabled by @boenrobot in https://github.com/Shardj/zf1-future/pull/363

### Fixed
- Finnish date translations by @Lodewyk in https://github.com/Shardj/zf1-future/pull/368
- addressed 5th sendmail param validation using -f (#326) by @develart-projects in https://github.com/Shardj/zf1-future/pull/371

## [1.23.2] - 2023-08-15
### Fixed
- corrected versioning and changelog

## [1.23.1] - 2023-08-15
### Fixed
- Pdo transaction bring back like php7 by @hungtrinh in #365
- sendmail header sanitization quick-fix, as described in #326 by @develart-projects in #366

## [1.23.0] - 2023-08-10
### Added
- Made tests be able to run on all supported PHP versions, and run successfully by @boenrobot in #353
- Extend native SessionHandlerInterface by @holtkamp in #357

### Fixed
- Added typecast to stop depreciation messages by @krytenuk in #325
- Version and minor fixes by @develart-projects in #364

## [1.22.1] - 2023-08-07
### Fixed
- getTranslator() docblocks for the Zend_Form family by @boenrobot in #311
- Fixed the version test since the latest release. by @boenrobot in #312
- Fix: pin phpunit to 9 instead of latest (10) in github actions by @hungtrinh in #321
- Pdo sqlite keep bc since php81 by @hungtrinh in #320
- Keep pdo mysql adapter fetch digit field type BC with php <= 8.0 by @hungtrinh in #324
- PDO: Fix partial error return when using a encrypted connection by @TAINCER in #327
- Partial helper pull vars from view model by @hungtrinh in #329
- [Zend_Ldap] php 8.1 & 8.2 compatibility fixes by @hungtrinh in #333
- SUPEE-10752 from Magento 1.9.3.9 by @fballiano in #313
- Set stream context before opening socket by @tsmgeek in #330
- Fixed PHPDoc in Zend_Validate_Regex by @PHPGangsta in #332
- [Github action] - On test zend ldap by @hungtrinh in #335
- zend-validate fix issue: File "Intelligentmail.php" does not exist by @hungtrinh in #336
- Fixing typo in README.txt generation part by @me-ve in #338
- isNumber() bugfix by @develart-projects in #262
- PHP8.2 - Fix null beeing passed to urlencode by @griesi007 in #358
- Basic Sendgrid Transport Class by @tsmgeek in #331
- Fix/cache apcu update by @emelyanov-s in #342
- Fix PHPDoc for @methods to ensure static analysers understand it by @holtkamp in #349
- Added more precise return types on Zend_Controller_Request_Http by @staabm in #347
- Fix docblock in Zend_Json_Server by @kiatng in #361

## [1.22.0] - 2023-01-16
### Added
- Github actions and test improvements #298, #292, #287, #285, #284, #280, #275, #273, #272, #269
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Zend Framework 1 now for PHP 8.1!
### Classic ZF1 Reborn
Zend may have abandoned the original Zend Framework, but the global Zend Framework Community has not! Since Zend sentenced ZF1 to EOL, the Zend Framework community around the globe has continued to work and build on what we consider to be one of the best PHP frameworks of all time.
Framework is tested by users up to PHP version 8.1. Note, that with 8.2+ you can experience some incompatibilities.

# ZF1-Future Sponsors
### Products and Projects built with ZF1-Future:
Expand Down
2 changes: 2 additions & 0 deletions bin/classmap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
exit(2);
}
$libraryPath = $opts->l;
} else {
$libraryPath = '.';
}
$libraryPath = str_replace(DIRECTORY_SEPARATOR, '/', realpath($libraryPath));

Expand Down
7 changes: 5 additions & 2 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.24.0",
"keywords": [
"framework",
"zf1"
Expand All @@ -11,6 +12,7 @@
"require": {
"php": ">=7.1",
"symfony/polyfill-php81": "^1.24",
"symfony/polyfill-ctype": "^1.27",
"symfony/polyfill-mbstring": "^1.26"
},
"suggest": {
Expand All @@ -33,9 +35,10 @@
}
},
"require-dev": {
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^7|^8|^9",
"php-parallel-lint/php-parallel-lint": "^1.3",
"rector/rector": "^0.14.8"
"rector/rector": "^0.12.19",
"yoast/phpunit-polyfills": "2.0"
},
"archive": {
"exclude": ["/demos", "/documentation", "/tests"]
Expand Down
8 changes: 6 additions & 2 deletions library/Zend/Auth/Adapter/DbTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,12 @@ protected function _authenticateValidateResultSet(array $resultIdentities)
protected function _authenticateValidateResult($resultIdentity)
{
$zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match');

if ($resultIdentity[$zendAuthCredentialMatchColumn] != '1') {

if (empty($resultIdentity)) {
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
$this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
return $this->_authenticateCreateAuthResult();
} elseif ($resultIdentity[$zendAuthCredentialMatchColumn] != '1') {
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
$this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.';
return $this->_authenticateCreateAuthResult();
Expand Down
12 changes: 5 additions & 7 deletions library/Zend/Cache/Backend/Apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function load($id, $doNotTestCacheValidity = false)
{
$tmp = apcu_fetch($id);
if (is_array($tmp)) {
return $tmp[0];
return $tmp[0] ?? false;
}
return false;
}
Expand All @@ -89,7 +89,7 @@ public function test($id)
{
$tmp = apcu_fetch($id);
if (is_array($tmp)) {
return $tmp[1];
return $tmp[1] ?? false;
}
return false;
}
Expand All @@ -108,7 +108,7 @@ public function test($id)
*/
public function save($data, $id, $tags = [], $specificLifetime = false)
{
$lifetime = $this->getLifetime($specificLifetime);
$lifetime = $this->getLifetime($specificLifetime) ?? 0;
$result = apcu_store($id, [$data, time(), $lifetime], $lifetime);
if (count($tags) > 0) {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
Expand Down Expand Up @@ -146,8 +146,7 @@ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = [])
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
return apcu_clear_cache('user');
break;
return apcu_clear_cache();
case Zend_Cache::CLEANING_MODE_OLD:
$this->_log("Zend_Cache_Backend_Apc::clean() : CLEANING_MODE_OLD is unsupported by the Apc backend");
break;
Expand All @@ -158,7 +157,6 @@ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = [])
break;
default:
Zend_Cache::throwException('Invalid mode for clean() method');
break;
}
}

Expand Down Expand Up @@ -259,7 +257,7 @@ public function getIdsMatchingAnyTags($tags = [])
public function getIds()
{
$ids = [];
$iterator = new APCIterator('user', null, APC_ITER_KEY);
$iterator = new APCUIterator(null, APC_ITER_KEY);
foreach ($iterator as $item) {
$ids[] = $item['key'];
}
Expand Down
9 changes: 8 additions & 1 deletion library/Zend/Cache/Backend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
$this->_recursiveMkdirAndChmod($id);
}
if (!is_writable($path)) {
$this->_log('Zend_Cache_Backend_File::save() : path ' . $path . ' is not writable');
return false;
}
}
Expand Down Expand Up @@ -1011,14 +1012,20 @@ protected function _filePutContents($file, $string)
$result = false;
$f = @fopen($file, 'ab+');
if ($f) {
if ($this->_options['file_locking']) @flock($f, LOCK_EX);
if ($this->_options['file_locking']) {
@flock($f, LOCK_EX);
}
fseek($f, 0);
ftruncate($f, 0);
$tmp = @fwrite($f, $string);
if (!($tmp === FALSE)) {
$result = true;
} else {
$this->_log("Zend_Cache_Backend_File::_filePutContents() : failed to write contents");
}
@fclose($f);
} else {
$this->_log("Zend_Cache_Backend_File::_filePutContents() : we can't obtain handle");
}
@chmod($file, $this->_options['cache_file_perm']);
return $result;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend/Static.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Zend_Cache_Backend_Static
*
* @param string $name
* @param mixed $value
* @return Zend_Cache_Backend_Static
* @return $this
*/
public function setOption($name, $value)
{
Expand Down
Loading

0 comments on commit 1cefa67

Please sign in to comment.