Skip to content

Require PHP 8.2 or newer - #651

Merged
hxdimpf merged 5 commits into
opencaching:masterfrom
jrmajor:pin-php
Oct 28, 2026
Merged

hxdimpf merged 5 commits into
opencaching:masterfrom
jrmajor:pin-php

Conversation

@jrmajor

@jrmajor jrmajor commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Based on information from #650 (comment), bumps the minimum PHP version from 5.6 to 7.4 in composer.json, okapi/composer.json and the README.

Update: bumped it to 8.2.

The committed okapi/vendor/ was regenerated with composer dump-autoload (Composer 2). The old autoloader dated from 2017 and was made by Composer 1. The new one adds platform_check.php, so OKAPI stops with a clear error on PHP versions older than 7.4 instead of failing somewhere later.

Also removed the SET NAMES fallback from Db.php. It was only used on PHP older than 5.3.6, which didn't support the charset DSN option. The connection charset is still set through the DSN.

@jrmajor
jrmajor marked this pull request as draft October 16, 2026 18:15
@jrmajor
jrmajor marked this pull request as ready for review October 17, 2026 13:04
@jrmajor

jrmajor commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

I tested both on local OCPL and OCDE, seems to work fine on both.

@andrixnet @harrieklomp Could you confirm that no OCPL node is running older PHP version? Also, do you plan upgrading OCRO, OCNL and OCUS? Do you know what version is OCUK using?

@andrixnet

andrixnet commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

OCRO, OCNL, OCUS currently run 7.4. Upgrade is planned, however I cannot promise a precise timeframe.
I do not know what version the others are running.

@jrmajor

jrmajor commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! In the meantime I also found opencaching/opencaching-pl#2364, so I believe that OCUK should be good too.

@hxdimpf hxdimpf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

  • The autoloader is exactly what Composer generates. I ran composer dump-autoload (Composer 2.10.3) in okapi/ on this branch, and the result is byte-identical to the committed okapi/vendor/.
  • The new platform check works: on PHP 7.3 loading vendor/autoload.php stops in platform_check.php with the version message; on PHP 7.4 and 8.4 it loads and okapi\core\Okapi is found.
  • Db.php: dropping the SET NAMES fallback is fine; the charset DSN option is there since PHP 5.3.6.
  • On the VM (this branch on the current master), OCDE and OCPL on MariaDB 10.11 and 10.0, with the suite from #653, read-only and --write: 0 failures.

With @andrixnet's answer (OCRO, OCNL, OCUS on 7.4) and OCUK covered, 7.4 is the right floor. It also makes #652 safe, which needs PHP 7.0 for random_int() / random_bytes().

@hxdimpf

hxdimpf commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

An update on the PHP versions: @andrixnet told me by mail that OCRO, OCNL and OCUS have now moved to PHP 8.2, and that from his side OKAPI can require 8.2. Andrei, please correct me if I got that wrong.

So the open question is the remaining installations. @stefopl @jrmajor (opencaching.pl) and @harrieklomp (OCUK): do they run PHP 8.2 or newer? A yes or no is enough; nobody needs to post exact versions.

If all of them do, I'd suggest raising the floor in this PR from 7.4 to 8.2 instead of doing it in two steps. With PHP 8 as the minimum, the E_STRICT check in OkapiErrorHandler can go as well (the "drop when PHP 8 is required" TODO from #650), because PHP 8 never raises E_STRICT. @jrmajor, would you rather do that here, or merge this as it is and leave 8.2 to a small follow-up PR? I'm happy to prepare the follow-up and test it on the OCDE and OCPL setups.

@stefopl

stefopl commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

OCPL, OCUK 8.3

@andrixnet

Copy link
Copy Markdown
Contributor

OCRO, OCNL, OCUS: PHP-8.2

IMO you can raise the floor to 8.2

@hxdimpf

hxdimpf commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Thanks @stefopl and @andrixnet. So every installation now runs PHP 8.2 or newer (OCPL and OCUK 8.3; OCRO, OCNL and OCUS 8.2).

@jrmajor, would you raise this PR to >=8.2? That would also let us drop the E_STRICT check in OkapiErrorHandler (the 2048 with the "drop when PHP 8 is required" TODO from #650): PHP 8 never raises E_STRICT. I'd do that as a small follow-up PR once this one is merged.

@hxdimpf

hxdimpf commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@jrmajor, a gentle ping: since every installation runs PHP 8.2 or newer, would you raise this PR to >=8.2? If you'd rather leave it, I can open a small follow-up instead (floor >=8.2 plus dropping the 2048 E_STRICT check in OkapiErrorHandler) and credit this PR. Either is fine with me.

@jrmajor

jrmajor commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Updated requirement to PHP 8.2.

@jrmajor jrmajor changed the title Require PHP 7.4 or newer Require PHP 8.2 or newer Oct 28, 2026

@hxdimpf hxdimpf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving the 8.2 version (head bb1ea37). Tested on our VM (PHP 8.2.31): OCDE, OCPL on MariaDB 10.11 and OCPL on MariaDB 10.0, test suite read-only and with --write, 0 failures. The regenerated okapi/vendor/ is byte-identical to composer dump-autoload with Composer 2, and the removed workarounds are dead code on 8.2. Thanks for taking the E_STRICT check out too.

Nit: the description still says the platform check stops PHP "older than 7.4"; it's 8.2 now.

@hxdimpf
hxdimpf merged commit c24b53a into opencaching:master Oct 28, 2026
hxdimpf added a commit to OpencachingDeutschland/okapi that referenced this pull request Oct 28, 2026
@jrmajor
jrmajor deleted the pin-php branch October 28, 2026 12:37
hxdimpf added a commit that referenced this pull request Nov 2, 2026
Entries in `etc/changes.xml` for the changes merged since the last
changelog PR (#665) that matter to client developers or site admins:
#649, #654, #646, #651, #682, #680, #666, #676, #672, #671, #667.

Version numbers and times were filled in by `etc/update_changes.php`.
#652 has no visible change for clients, so it has no entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants