This can only happen if you haven’t installed a specific version of PHP while using the third-party repositories provided by Ondrej Sury.
Without the sury repos:
apt install php-redis
will install the current version from the Debian repos and will not be automatically updated to a newer version during the lifetime of the distribution release.
With sury repos enabled:
apt install php-redis
will install the latest version from the sury repos (currently 8.3) and will automatically be upgraded to a newer version (when available) by runningapt full-upgrade
.
apt install php8.2-redis
will install version 8.2 and will not be automatically upgraded to a newer version.
So my recommendation is to always explicitly install a specific version, then you won’t get into a situation where your PHP packages get updated to a new version before Nextcloud fully supports it.