From 58b2dcd3317716b38af5a414f40bc94b8faa72ed Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Mon, 20 Apr 2026 21:18:23 -0700 Subject: [PATCH 1/2] Fix PHP 4 constructor in HTML_QuickForm_depselect for PHP 8 PHP 4-style constructors (method name matching class name) were deprecated in PHP 7 and removed in PHP 8. Rename to __construct() and call parent::__construct(). A runtime shim preserves compatibility with older xataface bundles whose PEAR HTML_QuickForm_input still exposes only the PHP 4 constructor. Also adds dev-only composer.json and a GitHub Actions lint matrix covering PHP 5.6 through 8.3. --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ HTML/QuickForm/depselect.php | 23 +++++++++++++++-------- composer.json | 13 +++++++++++++ 3 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 composer.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fea4c6f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: + - master + - 'claude/**' + pull_request: + branches: + - master + +jobs: + lint: + name: PHP ${{ matrix.php }} lint + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + php: ['5.6', '7.4', '8.0', '8.1', '8.2', '8.3'] + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist --no-progress + + - name: Parallel lint + run: vendor/bin/parallel-lint --exclude vendor . diff --git a/HTML/QuickForm/depselect.php b/HTML/QuickForm/depselect.php index 9196817..86418cf 100644 --- a/HTML/QuickForm/depselect.php +++ b/HTML/QuickForm/depselect.php @@ -2,15 +2,23 @@ require_once 'HTML/QuickForm/text.php'; class HTML_QuickForm_depselect extends HTML_QuickForm_text { - - function HTML_QuickForm_depselect( - $elementName=null, - $elementLabel=null, - $attributes=null, + + function __construct( + $elementName=null, + $elementLabel=null, + $attributes=null, $properties=null){ - parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + // PHP 4-style parent constructors are fatal in PHP 8. Prefer + // parent::__construct(), but fall back to the PHP 4 ctor name + // for installations running against pre-modernized PEAR + // HTML_QuickForm bundles shipped with older xataface versions. + if (is_callable(array('HTML_QuickForm_input', '__construct'))) { + parent::__construct($elementName, $elementLabel, $attributes); + } else { + parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + } } - + function toHtml(){ $oldFrozen = $this->_flagFrozen; $this->_flagFrozen = 0; @@ -23,4 +31,3 @@ function toHtml(){ return $out; } } - diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..9c9be2f --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "shannah/xataface-module-depselect", + "description": "Xataface dependent-select widget module.", + "type": "xataface-module", + "license": "LGPL-2.1-or-later", + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/phpstan": "^1.10" + } +} From 27f96416991fc6521bebd639849866e8b127dee9 Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Tue, 21 Apr 2026 04:31:18 +0000 Subject: [PATCH 2/2] Remove unused phpstan/phpstan dev dependency to fix PHP 5.6 CI PHPStan requires PHP 7.2+ but this project supports PHP 5.6+. Since PHPStan is not used in the CI workflow (only parallel-lint is run), removing it fixes the dependency resolution failure on PHP 5.6. Co-Authored-By: Claude Opus 4.6 --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9c9be2f..32c2757 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "php": ">=5.6" }, "require-dev": { - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpstan/phpstan": "^1.10" + "php-parallel-lint/php-parallel-lint": "^1.3" } }