Forcing an update on Nextcloud that stopped working after a PHP update

Hello, this is Munou.
By suddenly upgrading to PHP 8.2.7, Nextcloud, which was supported up to PHP 8.0, stopped starting.
This version of Nextcloud is not compatible with PHP>=8.2.
You are currently running 8.2.7.
Only this message was displayed, and I couldn't even update from the CLI when I tried.
So, I found a way to spoof the PHP version that Nextcloud recognizes.
The location is `/nextcloud/lib/versioncheck.php` within the Nextcloud directory.
*The following is already updated. Long commented-out sections have been removed.
<?php
declare(strict_types=1);
if (PHP_VERSION_ID < 80000) {
http_response_code(500);
echo 'This version of Nextcloud requires at least PHP 8.0<br/>';
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
exit(1);
}
// Show warning if >= PHP 8.3 is used as Nextcloud is not compatible with >= PHP 8.3 for now
if (PHP_VERSION_ID >= 80300) {
http_response_code(500);
echo 'This version of Nextcloud is not compatible with PHP>=8.3.<br/>';
echo 'You are currently running ' . PHP_VERSION . '.';
exit(1);
}
The problem is here.
if (PHP_VERSION_ID >= 80300) {
It seems to check the version here, so make it the same as or higher than the PHP version you have installed.
In my case, since I had PHP 8.2.7, I changed it as follows.
if (PHP_VERSION_ID >= 80207) {
Then, from the CLI,
sudo -u www-data php /var/www/html/cloud/occ update:check
worked.
Please specify the user and set the appropriate path so that occ can be executed.
I upgraded all the way to the latest version, and I think it was good in the end because the performance became much lighter.
However, what about this specification...?
Regardless of PHP, I feel like it should be possible to update by default, but it's unclear why such a specification was adopted.
That's all for now.