Skip to content

Commit 6536801

Browse files
committed
feat: PHP 8.5 support
1 parent 44a1a60 commit 6536801

File tree

17 files changed

+148
-112
lines changed

17 files changed

+148
-112
lines changed

.github/workflows/backend.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
timeout-minutes: 5
5858
strategy:
5959
matrix:
60-
php: ["8.2", "8.3", "8.4"]
60+
php: ["8.2", "8.3", "8.4", "8.5"]
6161
env:
6262
extensions: mbstring, ctype, curl, gd, apcu, memcached, redis
6363
ini: apc.enabled=1, apc.enable_cli=1, pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
@@ -104,7 +104,7 @@ jobs:
104104
extensions: ${{ env.extensions }}
105105
ini-values: ${{ env.ini }}
106106
coverage: pcov
107-
tools: phpunit:10.5.38, psalm:5.26.1
107+
tools: phpunit:11.5.44, psalm:5.26.1
108108

109109
- name: Setup problem matchers
110110
run: |
@@ -127,7 +127,7 @@ jobs:
127127
run: phpunit -c phpunit.ci.xml --coverage-clover ${{ github.workspace }}/clover.xml
128128

129129
- name: Statically analyze using Psalm
130-
if: always() && steps.finishPrepare.outcome == 'success' && matrix.php != '8.4'
130+
if: always() && steps.finishPrepare.outcome == 'success' && matrix.php != '8.4' && matrix.php != '8.5'
131131
run: psalm --output-format=github --php-version=${{ matrix.php }} --report=sarif/psalm.sarif --report-show-info=false
132132

133133
- name: Upload coverage results to Codecov
@@ -144,7 +144,7 @@ jobs:
144144
env_vars: PHP
145145

146146
- name: Upload code scanning results to GitHub
147-
if: always() && steps.finishPrepare.outcome == 'success' && github.repository == 'getkirby/kirby' && matrix.php != '8.4'
147+
if: always() && steps.finishPrepare.outcome == 'success' && github.repository == 'getkirby/kirby' && matrix.php != '8.4' && matrix.php != '8.5'
148148
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # pin@v3
149149
with:
150150
sarif_file: sarif
@@ -205,8 +205,8 @@ jobs:
205205
extensions: ${{ env.extensions }}
206206
coverage: none
207207
tools: |
208-
composer:2.4.4, composer-normalize:2.28.3, composer-require-checker:4.1.0,
209-
composer-unused:0.7.12, phpmd:2.13.0
208+
composer:2.9.1, composer-normalize:2.48.2, composer-require-checker:4.18.0,
209+
composer-unused:0.9.5, phpmd:2.15.0
210210
211211
- name: Validate composer.json/composer.lock
212212
if: always() && steps.finishPrepare.outcome == 'success'
@@ -264,7 +264,7 @@ jobs:
264264
with:
265265
php-version: ${{ env.php }}
266266
coverage: none
267-
tools: php-cs-fixer:3.65.0
267+
tools: php-cs-fixer:3.90.0
268268

269269
- name: Cache analysis data
270270
id: finishPrepare

composer.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"source": "https://github.com/getkirby/kirby"
2525
},
2626
"require": {
27-
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
28-
"ext-SimpleXML": "*",
27+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
2928
"ext-ctype": "*",
3029
"ext-curl": "*",
3130
"ext-dom": "*",
@@ -36,8 +35,9 @@
3635
"ext-libxml": "*",
3736
"ext-mbstring": "*",
3837
"ext-openssl": "*",
38+
"ext-simplexml": "*",
3939
"christian-riesen/base32": "1.6.0",
40-
"claviska/simpleimage": "4.2.1",
40+
"claviska/simpleimage": "4.4.0",
4141
"composer/semver": "3.4.4",
4242
"filp/whoops": "2.18.4",
4343
"getkirby/composer-installer": "^1.2.1",
@@ -52,13 +52,13 @@
5252
"symfony/polyfill-php72": "*"
5353
},
5454
"suggest": {
55-
"ext-PDO": "Support for using databases",
5655
"ext-apcu": "Support for the Apcu cache driver",
5756
"ext-exif": "Support for exif information from images",
5857
"ext-fileinfo": "Improved mime type detection for files",
5958
"ext-imagick": "Improved thumbnail generation",
6059
"ext-intl": "Improved i18n number formatting",
6160
"ext-memcached": "Support for the Memcached cache driver",
61+
"ext-pdo": "Support for using databases",
6262
"ext-redis": "Support for the Redis cache driver",
6363
"ext-sodium": "Support for the crypto class and more robust session handling",
6464
"ext-zip": "Support for ZIP archive file functions",
@@ -82,15 +82,10 @@
8282
},
8383
"optimize-autoloader": true,
8484
"platform": {
85-
"php": "8.2.0"
85+
"php": "8.3.0"
8686
},
8787
"platform-check": false
8888
},
89-
"extra": {
90-
"unused": [
91-
"symfony/polyfill-intl-idn"
92-
]
93-
},
9489
"scripts": {
9590
"post-update-cmd": "curl -o cacert.pem https://curl.se/ca/cacert.pem",
9691
"analyze": [

composer.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dependencies/spyc/Spyc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* into a PHP array. It currently supports a very limited subsection of
88
* the YAML spec.
99
*
10-
* @version 0.6.3 (Kirby fork for PHP 8.1+)
10+
* @version 0.6.4 (Kirby fork for PHP 8.5+)
1111
* @author Vlad Andersen <[email protected]>
1212
* @author Chris Wanstrath <[email protected]>
1313
* @link https://github.com/mustangostang/spyc/
@@ -877,7 +877,7 @@ private function addArray($incoming_data, $incoming_indent)
877877
return $this->addArrayInline($incoming_data, $incoming_indent);
878878

879879
$key = key($incoming_data);
880-
$value = isset($incoming_data[$key]) ? $incoming_data[$key] : null;
880+
$value = $key !== null && isset($incoming_data[$key]) ? $incoming_data[$key] : null;
881881
if ($key === '__!YAMLZero') $key = '0';
882882

883883
if ($incoming_indent == 0 && !$this->_containsGroupAlias && !$this->_containsGroupAnchor) { // Shortcut for root-level values.

src/Cms/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ protected function transformUserSingle(
213213
$result = $this->transformModel($addressProp, User::class, 'name', 'email');
214214

215215
$address = array_keys($result)[0] ?? null;
216-
$name = $result[$address] ?? null;
216+
$name = $result[$address ?? ''] ?? null;
217217

218218
// if the array is non-associative, the value is the address
219219
if (is_int($address) === true) {

src/Cms/PageActions.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,14 @@ public function createChild(array $props): Page
498498
'site' => $this->site(),
499499
];
500500

501-
$modelClass = static::$models[$props['template'] ?? null] ?? static::class;
502-
return $modelClass::create($props);
501+
if (
502+
($template = $props['template'] ?? null) &&
503+
($model = static::$models[$template] ?? null)
504+
) {
505+
return $model::create($props);
506+
}
507+
508+
return static::create($props);
503509
}
504510

505511
/**

src/Cms/System.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function php(): bool
369369
{
370370
return
371371
version_compare(PHP_VERSION, '8.2.0', '>=') === true &&
372-
version_compare(PHP_VERSION, '8.5.0', '<') === true;
372+
version_compare(PHP_VERSION, '8.6.0', '<') === true;
373373
}
374374

375375
/**

src/Filesystem/Mime.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public static function fix(
125125
string|null $mime = null,
126126
string|null $extension = null
127127
): string|null {
128+
if ($mime === null || $extension === null) {
129+
return $mime;
130+
}
131+
128132
// fixing map
129133
$map = [
130134
'text/html' => [

src/Panel/Lab/Example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444

4545
public function collectTab(string|null $tab): string|null
4646
{
47-
if ($this->tabs === []) {
47+
if ($this->tabs === [] || $tab === null) {
4848
return null;
4949
}
5050

src/Panel/Panel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static function router(string|null $path = null): Response|null
321321
$auth = $route->attributes()['auth'] ?? true;
322322
$areaId = $route->attributes()['area'] ?? null;
323323
$type = $route->attributes()['type'] ?? 'view';
324-
$area = $areas[$areaId] ?? null;
324+
$area = $areas[$areaId ?? ''] ?? null;
325325

326326
// call the route action to check the result
327327
try {

0 commit comments

Comments
 (0)