Update from Nextcloud 30 to 31 fails

What type of hardware are you using: Raspberry Pi 3, 4+
What YunoHost version are you running: 12.0.17
How are you able to access your server: The webadmin
SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: No

Describe your issue

Hi Yunohost team,

I unfortunately get this error while trying to update Nextcloud from :

Error:
2025-06-04 10:51:45,418: DEBUG - syntax error, unexpected identifier “APP_NAME”, expecting “=”
2025-06-04 10:51:45,588: DEBUG - An unhandled exception has been thrown:
2025-06-04 10:51:45,589: DEBUG - ParseError: syntax error, unexpected identifier “APP_NAME”, expecting “=” in /var/www/nextcloud/apps/passwords/lib/AppInfo/Application.php:126

Here’s the corresponding data in the .php:

117 class Application extends App implements IBootstrap {

     const string APP_NAME = 'passwords';
 
     /**
      * Application constructor.
      *
      * @param array $urlParams
      */

126 public function __construct(array $urlParams = ) {
parent::__construct(self::APP_NAME, $urlParams);
}

All Nextcloud apps are up to date and there are none I can find in the list of unsupported apps for NC 31.
YNH_APP_CURRENT_VERSION: 30.0.4~ynh2 YNH_APP_ID: nextcloud YNH_APP_INSTANCE_NAME: nextcloud YNH_APP_INSTANCE_NUMBER: ‘1’ YNH_APP_MANIFEST_VERSION: 31.0.5~ynh1 YNH_APP_PACKAGING_FORMAT: ‘2.0’ YNH_APP_UPGRADE_TYPE: UPGRADE_APP

As per always thanks for the great work and hoping yup can help me here.

Best regards

Fil

Share relevant logs or error messages

https://paste.yunohost.org/raw/zavamoqoce

Hmmmmyeah so apparently having const string foobar = "value" in a syntax new in php8.3 and was not something valid in 8.2 …

But then in the upgrade flow the script wants to run an occ command … but runs it using php8.2 because .. nextcloud ain’t upgraded yet so it’s still somehow in version 30 (which uses php8.2) … but the new code is already here so it’s code intended for 8.3 …

It’s not clear to me what’s the proper fix is … Though i suppose we should in fact use the of php for the code we’re are upgrading to and not the code we are upgrading from …?

Edit: ah and on top of that I suppose we didnt catch this in our automatic test because it’s specifically the “passwords” app that triggers this case but during our test we don’t have that app installed…

1 Like

Hi all,
thanks @Aleks for the info and sorry it took so long to get back on this.
I’ve just tried updating to the newer version of Nextcloud available in ynh and get the same result.
I’m not sure how to go forward here as it seems that there’s a vicious circle between the php version and OC in my Nextcloud 30.
Is there any fix planned or an idea as to how I can upgrade?
The only thing I can think of is exporting my passwords (the app allows this), removing the Passwords app and then trying the update again.
Does this make sense or do you see any problems associated with this approach?
Thanks in advance and best regards from Germany
Fil

Hmmyeah I forgot about this thread / had no time to dig in, but i’ll try to have a look at fixing the package since in the end you may not be the only person to run into that kind of issue (since fundamentally it’s a bug in our package)

Otherwise the workaround with uninstalling/reinstalling the password app may work yeah, but shouldnt be needed in the Yunohost Spirit™

I’ll try to come back to this thread once I published a fix

Alrighty I pushed a fix here : Fix inconsistent php version during upgrade with OCC by alexAubin · Pull Request #815 · YunoHost-Apps/nextcloud_ynh · GitHub … let’s see if we can get it to testing and the main branch soonish

Hi all,
Thanks - the newest version of Nextcloud worked fine!