mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-28 11:08:53 -04:00
feat(php): add PHP 8.5 support, resolve deprecations, and optimize CI workflows (#4776)
- Extend composer.json and composer.lock PHP requirement to include PHP 8.5 - Add PHP 8.5 to test matrix in phpunit.yml and main.yml workflows - Modernize php-linter.yml to use setup-php@v2 with parallel matrix for PHP 8.2–8.5 - Propagate PHP 8.2 lint failures via shell loop in find -exec + while retaining batching for 8.3–8.5 - Add permissions: contents: read and cancel-in-progress concurrency to php-linter.yml - Remove obsolete Node.js and npm install steps from phpunit.yml - Update phpunit.yml runner to ubuntu-latest and composer cache action to v4 - Address PHP 8.5 deprecations and syntax: - Replace deprecated switch-case semicolon with standard colon in app/Config/Database.php - Replace non-standard (double) cast with (float) in app/Libraries/Token_lib.php - Remove obsolete curl_close() calls in app/Config/Validation/OSPOSRules.php and app/Libraries/Mailchimp_lib.php - Update INSTALL.md, workflows README, and bug report issue template to include PHP 8.5
This commit is contained in:
1 parent
8a8736ad0d
commit
386f976dcc
12 files changed
+43
-47
No files matched your search
@@ -81,6 +81,7 @@ body:
|
||||
label: 🔧 PHP Version
|
||||
description: What version of PHP are you running?
|
||||
options:
|
||||
- PHP 8.5
|
||||
- PHP 8.4
|
||||
- PHP 8.3
|
||||
- PHP 8.2
|
||||
|
||||
@@ -50,12 +50,12 @@ The `GITHUB_TOKEN` is automatically provided by GitHub Actions.
|
||||
|
||||
This repository also has these workflows:
|
||||
- `.github/workflows/main.yml` - PHP linting with PHP-CS-Fixer
|
||||
- `.github/workflows/phpunit.yml` - PHPUnit tests (runs on all PHP versions 8.1-8.4)
|
||||
- `.github/workflows/phpunit.yml` - PHPUnit tests (runs on all PHP versions 8.2-8.5)
|
||||
- `.github/workflows/php-linter.yml` - PHP linting
|
||||
|
||||
## Testing
|
||||
|
||||
PHPUnit tests are run separately via `.github/workflows/phpunit.yml` on every push and pull request, testing against PHP 8.1, 8.2, 8.3, and 8.4.
|
||||
PHPUnit tests are run separately via `.github/workflows/phpunit.yml` on every push and pull request, testing against PHP 8.2, 8.3, 8.4, and 8.5.
|
||||
|
||||
To test the build workflow:
|
||||
1. Add the required secrets
|
||||
|
||||
@@ -31,6 +31,7 @@ jobs:
|
||||
- '8.2'
|
||||
- '8.3'
|
||||
- '8.4'
|
||||
- '8.5'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@@ -2,25 +2,41 @@ name: PHP Linting
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
phplint:
|
||||
|
||||
name: PHP Lint ${{ matrix.php-version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-version:
|
||||
- '8.2'
|
||||
- '8.3'
|
||||
- '8.4'
|
||||
- '8.5'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: PHP Lint 8.2
|
||||
uses: dbfx/github-phplint/8.2@master
|
||||
with:
|
||||
folder-to-exclude: "! -path \"./vendor/*\" ! -path \"./folder/excluded/*\""
|
||||
- name: PHP Lint 8.3
|
||||
uses: dbfx/github-phplint/8.3@master
|
||||
with:
|
||||
folder-to-exclude: "! -path \"./vendor/*\" ! -path \"./folder/excluded/*\""
|
||||
- name: PHP Lint 8.4
|
||||
uses: dbfx/github-phplint/8.4@master
|
||||
with:
|
||||
folder-to-exclude: "! -path \"./vendor/*\" ! -path \"./folder/excluded/*\""
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: none
|
||||
|
||||
- name: Run PHP Lint
|
||||
run: |
|
||||
if [ "${{ matrix.php-version }}" = "8.2" ]; then
|
||||
find . -type f -name "*.php" ! -path "./vendor/*" ! -path "./node_modules/*" -exec sh -c 'for file do php -l "$file" || exit 1; done' sh {} +
|
||||
else
|
||||
find . -type f -name "*.php" ! -path "./vendor/*" ! -path "./node_modules/*" -exec php -l {} +
|
||||
fi
|
||||
php -l spark
|
||||
@@ -28,7 +28,7 @@ permissions:
|
||||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php-version }} / ${{ matrix.db-image }} Tests
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -37,6 +37,7 @@ jobs:
|
||||
- '8.2'
|
||||
- '8.3'
|
||||
- '8.4'
|
||||
- '8.5'
|
||||
db-image:
|
||||
- 'mariadb:10.5'
|
||||
- 'mariadb:10.6'
|
||||
@@ -72,25 +73,6 @@ jobs:
|
||||
fi
|
||||
echo "PHP $ACTUAL meets minimum $MIN"
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Get npm cache directory
|
||||
run: echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache npm dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ env.NPM_CACHE_DIR }}
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Start database
|
||||
run: |
|
||||
docker run -d --name mysql \
|
||||
@@ -124,7 +106,7 @@ jobs:
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
|
||||
|
||||
@@ -127,7 +127,7 @@ class Database extends Config
|
||||
case 'testing':
|
||||
$this->defaultGroup = 'tests';
|
||||
break;
|
||||
case 'development';
|
||||
case 'development':
|
||||
$this->defaultGroup = 'development';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -86,8 +86,6 @@ class OSPOSRules
|
||||
|
||||
$result = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$status = json_decode($result, true);
|
||||
|
||||
if (!empty($status['success'])) {
|
||||
|
||||
@@ -117,8 +117,6 @@ class MailchimpConnector
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpVerb);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
return $result ? json_decode($result, true) : false;
|
||||
|
||||
@@ -178,7 +178,7 @@ class Token_lib
|
||||
$quantity = (isset($parsed_results['W'])) ? (int) $parsed_results['W'] / 1000 : 1;
|
||||
$item_id_or_number_or_item_kit_or_receipt = (isset($parsed_results['I'])) ?
|
||||
$parsed_results['I'] : $item_id_or_number_or_item_kit_or_receipt;
|
||||
$price = (isset($parsed_results['P'])) ? (double) $parsed_results['P'] : null;
|
||||
$price = (isset($parsed_results['P'])) ? (float) $parsed_results['P'] : null;
|
||||
}
|
||||
} else {
|
||||
$quantity = 1;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
"matrix": "https://matrix.to/#/#opensourcepos_Lobby:gitter.im"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2.35 <8.3 || >=8.3.36 <8.4 || >=8.4.27",
|
||||
"php": ">=8.2.35 <8.3 || >=8.3.36 <8.4 || >=8.4.27 <8.5 || >=8.5.12 <8.6",
|
||||
"ext-intl": "*",
|
||||
"codeigniter4/framework": "4.7.4",
|
||||
"dompdf/dompdf": "^3.1.6",
|
||||
|
||||
Generated
+2
-2
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5b7bf691a189373a64ba0cd8c9b3e46a",
|
||||
"content-hash": "13515c65b00fddcbe40933bd582f44f1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "codeigniter4/framework",
|
||||
@@ -5224,7 +5224,7 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=8.2.35 <8.3 || >=8.3.36 <8.4 || >=8.4.27",
|
||||
"php": ">=8.2.35 <8.3 || >=8.3.36 <8.4 || >=8.4.27 <8.5 || >=8.5.12 <8.6",
|
||||
"ext-intl": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
## Server Requirements
|
||||
|
||||
- PHP version `8.2.35` to `8.4.27` are supported (minimum patch levels required for CVE-2026-109618 / CVE-2026-109619 security fixes). PHP version `≤ 8.1` is NOT supported. Please note that PHP needs to have the extensions `php-json`, `php-gd`, `php-bcmath`, `php-intl`, `php-openssl`, `php-mbstring`, `php-curl` and `php-xml` installed and enabled. An unstable master build can be downloaded in the releases section.
|
||||
- PHP version `8.2` (>= `8.2.35`), `8.3` (>= `8.3.36`), `8.4` (>= `8.4.27`), and `8.5` (>= `8.5.12`) are supported (minimum patch levels required for CVE-2026-109618 / CVE-2026-109619 security fixes). PHP version `≤ 8.1` is NOT supported. Please note that PHP needs to have the extensions `php-json`, `php-gd`, `php-bcmath`, `php-intl`, `php-openssl`, `php-mbstring`, `php-curl` and `php-xml` installed and enabled. An unstable master build can be downloaded in the releases section.
|
||||
- MySQL `5.7` is supported, also MariaDB replacement `10.x` is supported and might offer better performance.
|
||||
- Apache `2.4` is supported. Nginx should work fine too, see [wiki page here](https://github.com/opensourcepos/opensourcepos/wiki/Local-Deployment-using-LEMP).
|
||||
- Raspberry PI based installations proved to work, see [wiki page here](<https://github.com/opensourcepos/opensourcepos/wiki/Installing-on-Raspberry-PI---Orange-PI-(Headless-OSPOS)>).
|
||||
|
||||
Reference in new issue
Block a user