Fix PHP 8.5 upgrade being falsely reported as a downgrade - #2596
Open
sharyaropensource wants to merge 1 commit into
Open
Fix PHP 8.5 upgrade being falsely reported as a downgrade#2596sharyaropensource wants to merge 1 commit into
sharyaropensource wants to merge 1 commit into
Conversation
In PHP 8.5 the opcache extension is statically compiled into the base image, so there is no opcache.so and the php:8.4-style 'docker-php-ext-opcache.ini' with 'zend_extension=opcache' no longer resolves. Users who persisted /usr/local/etc/php/conf.d from a previous PHP 8.4 based image therefore get a startup warning: Failed loading Zend extension 'opcache' ... Because display_errors is set to STDOUT, that warning ends up in the version string captured by the entrypoint for the downgrade check, which corrupts the comparison and makes Nextcloud refuse to start with: Can't start Nextcloud because the version of the data (...) is higher than the docker image version (...) and downgrading is not supported. Suppress PHP warnings while reading the installed/image version so a stale opcache zend_extension directive (or any other PHP startup warning) can no longer poison the version comparison. See nextcloud#2595 Signed-off-by: sharyaropensource <sharyaropensource@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2595 — upgrading Nextcloud on the PHP 8.5 base image fails with:
Root cause
In PHP 8.5 the
opcacheextension is statically compiled into the official base image, so there is noopcache.soand the PHP 8.4-styledocker-php-ext-opcache.inicontainingzend_extension=opcacheno longer resolves.Users who persisted
/usr/local/etc/php/conf.dfrom a previous PHP 8.4 based image therefore get a PHP startup warning on everyphpinvocation:Because
display_errorsis set toSTDOUT, that warning is captured into the version string the entrypoint reads for its downgrade check (installed_version/image_version). The corrupted value makesversion_greaterreport a false downgrade, so Nextcloud refuses to start.Fix
Suppress PHP warnings while reading the installed/image version in
docker-entrypoint.sh(-d display_errors=stderr+2>/dev/null) so a stalezend_extension=opcachedirective (or any other PHP startup warning) can no longer poison the version comparison.Verification
Reproduced the exact issue error using the published
nextcloud:34-fpmimage with a stalezend_extension=opcachedirective inconf.dand the original entrypoint. After the fix, the entrypoint correctly proceeds toInitializing nextcloud 34.0.3 ... Upgrading nextcloud from 34.0.0.12 ...instead of blocking with the false downgrade.The change was applied to
docker-entrypoint.shand propagated to every generatedentrypoint.sh(as done byupdate.sh).