From 96dba464ea59b7a41236cc9ec04a33a66c6e0a37 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 26 Mar 2022 16:14:27 +0100 Subject: [PATCH 01/19] add annotations for php 8.1 compatibility --- idiorm.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/idiorm.php b/idiorm.php index 2b1f38ca..128c6b7b 100644 --- a/idiorm.php +++ b/idiorm.php @@ -2209,14 +2209,17 @@ public function delete_many() { // --- ArrayAccess --- // // --------------------- // + #[\ReturnTypeWillChange] public function offsetExists($key) { return array_key_exists($key, $this->_data); } + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->get($key); } + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { if(is_null($key)) { throw new InvalidArgumentException('You must specify a key/array index.'); @@ -2224,6 +2227,7 @@ public function offsetSet($key, $value) { $this->set($key, $value); } + #[\ReturnTypeWillChange] public function offsetUnset($key) { unset($this->_data[$key]); unset($this->_dirty_fields[$key]); @@ -2445,6 +2449,7 @@ public function as_array() { * Get the number of records in the result set * @return int */ + #[\ReturnTypeWillChange] public function count() { return count($this->_results); } @@ -2454,6 +2459,7 @@ public function count() { * over the result set. * @return \ArrayIterator */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->_results); } @@ -2463,6 +2469,7 @@ public function getIterator() { * @param int|string $offset * @return bool */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->_results[$offset]); } @@ -2472,6 +2479,7 @@ public function offsetExists($offset) { * @param int|string $offset * @return mixed */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->_results[$offset]; } @@ -2481,6 +2489,7 @@ public function offsetGet($offset) { * @param int|string $offset * @param mixed $value */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->_results[$offset] = $value; } @@ -2489,6 +2498,7 @@ public function offsetSet($offset, $value) { * ArrayAccess * @param int|string $offset */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->_results[$offset]); } From efc8ea06698f53e2c479c7696f2b154c47c3a3cb Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 26 Mar 2022 16:19:01 +0100 Subject: [PATCH 02/19] add serialize functions for php 8.1 --- idiorm.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/idiorm.php b/idiorm.php index 128c6b7b..06253020 100644 --- a/idiorm.php +++ b/idiorm.php @@ -2503,6 +2503,14 @@ public function offsetUnset($offset) { unset($this->_results[$offset]); } + public function __serialize() { + return $this->serialize(); + } + + public function __unserialize($data) { + $this->unserialize($data); + } + /** * Serializable * @return string From 948b08afa01c51d345fa588e49d658c1e3d7ed8f Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Tue, 12 Jul 2022 16:45:42 +1000 Subject: [PATCH 03/19] fix: test against php 8.1 in ci --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fee02856..246237fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 5.6 - 7.0 - 7.1 + - 8.1 - hhvm env: PHPV=0 matrix: From ccfb8885501fd61801661926bb5287acc97a4ea8 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Sat, 16 Jul 2022 23:17:06 +1000 Subject: [PATCH 04/19] fix: patch dockerfile for ubuntu repo url --- test/docker_for_php52/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/docker_for_php52/Dockerfile b/test/docker_for_php52/Dockerfile index f9640b66..e44f0c26 100644 --- a/test/docker_for_php52/Dockerfile +++ b/test/docker_for_php52/Dockerfile @@ -4,6 +4,7 @@ FROM ubuntu:12.04 RUN mkdir /php && \ cd /php && \ + sed -i "s#archive.ubuntu.com#old-releases.ubuntu.com#g" /etc/apt/sources.list && \ apt-get update && \ apt-get install -y --no-install-recommends \ autoconf binutils build-essential bzip2 ca-certificates \ From 387a175d7d4a1fe8a36558f8e4ba4dfd276631cd Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Sun, 17 Jul 2022 22:36:27 +1000 Subject: [PATCH 05/19] add workflow beginnings --- .github/idiorm.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/idiorm.yml diff --git a/.github/idiorm.yml b/.github/idiorm.yml new file mode 100644 index 00000000..d3480871 --- /dev/null +++ b/.github/idiorm.yml @@ -0,0 +1,24 @@ +env: + REGISTRY: ghcr.io + IMAGE_NAME: treffynnon/php5.2cli:latest + +jobs: + test-idiorm: + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Pull docker image + script: | + docker pull ${{ steps.meta.outputs.tags }} From e911f35d94021c5109ba9fcb63ee3b689e40dced Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:11:34 +1000 Subject: [PATCH 06/19] test on php 8 and 8.1 --- .github/workflows/idiorm-workflow.yml | 2 +- README.markdown | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 9c30e575..d62e6105 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['5.4', '5.6', '7.0', '7.1', '7.4'] + php-versions: ['5.4', '5.6', '7.0', '7.1', '7.4', '8.0', '8.1'] name: PHP ${{ matrix.php-versions }} diff --git a/README.markdown b/README.markdown index b7ba3e62..6694b0a0 100644 --- a/README.markdown +++ b/README.markdown @@ -86,6 +86,11 @@ is a Docker setup in `./test/docker_for_php52` - check the readme in there for m Changelog --------- +#### 1.5.8 - released 2022-07-18 + +* Update to support PHP 8.1 [[edlerd](https://github.com/edlerd) and [aaronpk](https://github.com/aaronpk)] - [issue #370](https://github.com/j4mie/idiorm/pull/370) and [issue #372](https://github.com/j4mie/idiorm/pull/372) +* GitHub actions used to perform unit testing/CI [[Treffynnon](https://github.com/treffynnon)] + #### 1.5.7 - released 2020-04-29 * Fix argument order in call to join() [[CatalinFrancu](https://github.com/CatalinFrancu)] - [issue #357](https://github.com/j4mie/idiorm/pull/357) From ba23eea7e50ac67db80cbdb75316dd79038bf4d3 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:18:13 +1000 Subject: [PATCH 07/19] test on push only --- .github/workflows/idiorm-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index d62e6105..2ae9c2c0 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -2,7 +2,7 @@ env: REGISTRY: ghcr.io IMAGE_NAME: treffynnon/php5.2cli:latest -on: [push, pull_request] +on: push jobs: test-idiorm-with-php5-2: From c1a9c01ea08843e062e737af34f5837d03f4c5a4 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:19:18 +1000 Subject: [PATCH 08/19] remove outdated travis file --- .travis.yml | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 246237fd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -language: php -php: - - 5.4 - - 5.6 - - 7.0 - - 7.1 - - 8.1 - - hhvm -env: PHPV=0 -matrix: - include: - - php: 5.2 - dist: precise - env: PHPV=52 - - php: 5.3 - dist: precise -before_install: | - if [ "$PHPV" -eq 52 ]; then - pecl install phar - fi -install: | - if [ "$PHPV" -ne 52 ]; then - composer install - else - # special handling for PHP 5.2 testing as there is no composer available - export X="$HOME/.idiorm/bin" - mkdir -p "$X" - curl -sSfL https://github.com/treffynnon/php5.2-phpunit3.6.12-phar/releases/download/1.0.2/php52-phpunit.phar -o "$X/phpunit" - chmod +x "$X/phpunit" - fi -script: | - if [ "$PHPV" -ne 52 ]; then - composer run-script test -- --colors --coverage-text - else - # special handling for PHP 5.2 testing as there is no composer available - # we need phpunit-3.6.12, but there is no phar file for it so comment out for now - $X/phpunit --colors --coverage-text - fi -cache: - directories: - - $HOME/.composer/cache - - $HOME/.idiorm - - vendor \ No newline at end of file From b2397d1cd2f0f330e68022df1747ace75f3ca2bb Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:29:14 +1000 Subject: [PATCH 09/19] test across versions of php --- .github/workflows/idiorm-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 2ae9c2c0..56288c16 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['5.4', '5.6', '7.0', '7.1', '7.4', '8.0', '8.1'] + php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] name: PHP ${{ matrix.php-versions }} From efba3cae65508be127e800e2bc7f469badc3c4dc Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:32:54 +1000 Subject: [PATCH 10/19] remove php 5.4 --- .github/workflows/idiorm-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 56288c16..6d8605b3 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] name: PHP ${{ matrix.php-versions }} From f120281490139d4289a4c17b4c85f74b23ca7152 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:38:44 +1000 Subject: [PATCH 11/19] add php 5.4 --- .github/workflows/idiorm-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 6d8605b3..56288c16 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] + php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] name: PHP ${{ matrix.php-versions }} From 83a1c36809e59fa2b99653b49033cf7e3e591b51 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:42:36 +1000 Subject: [PATCH 12/19] attempt to get phpunit working in php 8 --- .github/workflows/idiorm-workflow.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 56288c16..47c65d1d 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -26,7 +26,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] + php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] + phpunit-versions: ['4.8', '4.8', '4.8', '4.8', '4.8', '4.8', '4.8', '8.0', '8.0'] name: PHP ${{ matrix.php-versions }} @@ -39,13 +40,10 @@ jobs: with: php-version: ${{ matrix.php-versions }} coverage: xdebug - tools: composer + tools: composer, phpunit:${{ matrix.phpunit-versions }} - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Install composer deps - run: composer install --no-progress --prefer-dist --optimize-autoloader - - name: Run phpunit tests run: composer run-script test -- --colors --coverage-text From 5d6d28bf31c7d216a19246714cb58c224ec02ee0 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 10:49:42 +1000 Subject: [PATCH 13/19] fix matrix --- .github/workflows/idiorm-workflow.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 47c65d1d..ee9b9132 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -26,8 +26,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2'] - phpunit-versions: ['4.8', '4.8', '4.8', '4.8', '4.8', '4.8', '4.8', '8.0', '8.0'] + php-versions: ['5.4', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] + phpunit-versions: ['4.8'] + include: + - php-versions: '8.0' + phpunit-versions: '8.5.21' + - php-versions: '8.2' + phpunit-versions: '8.5.21' name: PHP ${{ matrix.php-versions }} From 450dc964d2a414365214c31c5f98399b27833d3b Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 13:20:40 +1000 Subject: [PATCH 14/19] remove incorrectly committed workflow file --- .github/idiorm.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .github/idiorm.yml diff --git a/.github/idiorm.yml b/.github/idiorm.yml deleted file mode 100644 index d3480871..00000000 --- a/.github/idiorm.yml +++ /dev/null @@ -1,24 +0,0 @@ -env: - REGISTRY: ghcr.io - IMAGE_NAME: treffynnon/php5.2cli:latest - -jobs: - test-idiorm: - runs-on: ubuntu-latest - permissions: - contents: read - packages: read - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Pull docker image - script: | - docker pull ${{ steps.meta.outputs.tags }} From 41ee9d37a517c8b1bef1dafeb1ddc55545be9843 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 13:31:22 +1000 Subject: [PATCH 15/19] add return types for PHP 8 --- .github/workflows/idiorm-workflow.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index ee9b9132..6bb0f7db 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -50,5 +50,9 @@ jobs: - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Add PHP 8 return types + if: ${{ matrix.php-versions >= '8.0' }} + run: sed -i 's#setUp()#setUp(): void#' test/*.php && sed -i 's#tearDown()#tearDown(): void#' test/*.php + - name: Run phpunit tests run: composer run-script test -- --colors --coverage-text From 8844e41c8bb357cff30c1d16bedc85704517a649 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 13:34:15 +1000 Subject: [PATCH 16/19] try again --- .github/workflows/idiorm-workflow.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index 6bb0f7db..e5d716e5 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -52,7 +52,9 @@ jobs: - name: Add PHP 8 return types if: ${{ matrix.php-versions >= '8.0' }} - run: sed -i 's#setUp()#setUp(): void#' test/*.php && sed -i 's#tearDown()#tearDown(): void#' test/*.php + run: | + sed -i 's#setUp()#setUp(): void#' test/*.php + sed -i 's#tearDown()#tearDown(): void#' test/*.php - name: Run phpunit tests run: composer run-script test -- --colors --coverage-text From d24346cd48c699d7708d661faff44c61328bc077 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 13:39:02 +1000 Subject: [PATCH 17/19] alias framework_testcase --- test/bootstrap.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/bootstrap.php b/test/bootstrap.php index 7fa1c48b..9fc74731 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -124,3 +124,7 @@ public function getAttribute($attribute) { } } + +if (!class_exists('PHPUnit_Framework_TestCase')) { + class_alias('\PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase'); +} From a5c48d847b07fbaf163e76029d412b39f5c98e74 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 13:43:30 +1000 Subject: [PATCH 18/19] improve documentation etc --- .github/workflows/idiorm-workflow.yml | 7 ++++--- test/bootstrap.php | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/idiorm-workflow.yml b/.github/workflows/idiorm-workflow.yml index e5d716e5..08fe93d3 100644 --- a/.github/workflows/idiorm-workflow.yml +++ b/.github/workflows/idiorm-workflow.yml @@ -1,6 +1,3 @@ -env: - REGISTRY: ghcr.io - IMAGE_NAME: treffynnon/php5.2cli:latest on: push @@ -11,6 +8,10 @@ jobs: contents: read packages: read + env: + REGISTRY: ghcr.io + IMAGE_NAME: treffynnon/php5.2cli:latest + name: 'PHP 5.2' steps: - name: Checkout repository diff --git a/test/bootstrap.php b/test/bootstrap.php index 9fc74731..413f62fb 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -125,6 +125,9 @@ public function getAttribute($attribute) { } +/** + * Alias the test case class so that these same tests can run against PHPUnit >4 + */ if (!class_exists('PHPUnit_Framework_TestCase')) { class_alias('\PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase'); } From 98db4ffce41bc492705b64a12bfab084a2740422 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Mon, 18 Jul 2022 13:49:15 +1000 Subject: [PATCH 19/19] update readme with credits --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 6694b0a0..eeb80577 100644 --- a/README.markdown +++ b/README.markdown @@ -89,7 +89,7 @@ Changelog #### 1.5.8 - released 2022-07-18 * Update to support PHP 8.1 [[edlerd](https://github.com/edlerd) and [aaronpk](https://github.com/aaronpk)] - [issue #370](https://github.com/j4mie/idiorm/pull/370) and [issue #372](https://github.com/j4mie/idiorm/pull/372) -* GitHub actions used to perform unit testing/CI [[Treffynnon](https://github.com/treffynnon)] +* GitHub actions used to perform unit testing/CI [[Treffynnon](https://github.com/treffynnon) and [yan12125](https://github.com/yan12125)] #### 1.5.7 - released 2020-04-29