Skip to content

Support onlyoffice connector >= 10.1 and fix PHP 8.4 nullable deprecations#376

Open
NSO73 wants to merge 3 commits into
nextcloud:masterfrom
NSO73:fix/php84-and-connector-compat
Open

Support onlyoffice connector >= 10.1 and fix PHP 8.4 nullable deprecations#376
NSO73 wants to merge 3 commits into
nextcloud:masterfrom
NSO73:fix/php84-and-connector-compat

Conversation

@NSO73

@NSO73 NSO73 commented Jun 16, 2026

Copy link
Copy Markdown

What

Two fixes that let documentserver_community run with the current ONLYOFFICE connector on recent PHP / Nextcloud.

1. Support ONLYOFFICE connector >= 10.1 (AppConfig constructor change)

The onlyoffice connector 10.1 changed OCA\Onlyoffice\AppConfig::__construct from

(string $appName, IConfig, LoggerInterface, ICacheFactory)            // <= 10.0

to

(string $appName, IAppConfig, IConfig, IUserConfig, LoggerInterface, ICacheFactory)   // >= 10.1

With the old 4-argument call the app no longer boots:

TypeError: OCA\Onlyoffice\AppConfig::__construct(): Argument #2 ($appConfig)
must be of type OCP\IAppConfig, OC\AllConfig given

buildAppConfig() now detects the constructor arity at runtime and passes the
matching arguments, so it keeps working with both the old (<= 10.0) and the new
(>= 10.1) connector — and the Nextcloud versions that ship them (OCP\Config\IUserConfig
only exists on the newer ones).

2. PHP 8.4 — explicit nullable parameter types

PHP 8.4 deprecates implicitly nullable parameters (Type $x = null). Made the
nullable explicit (?Type) for the $password parameters in DocumentConverter,
ConverterBinary and DocumentStore. No behaviour change; removes the deprecation
warnings logged on every document conversion.

Testing

Verified on Nextcloud 33.0.5 / PHP 8.4 with onlyoffice connector 10.1.0: the app
boots, /healthcheck returns 200, documents open and convert.

NSO73 added 2 commits June 16, 2026 04:03
PHP 8.4 deprecates implicitly marking parameters as nullable
(Type $param = null). Make the nullable type explicit (?Type)
for the $password parameters in DocumentConverter, ConverterBinary
and DocumentStore.

Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com>
The onlyoffice connector 10.1 expanded AppConfig::__construct from
(string, IConfig, LoggerInterface, ICacheFactory) to
(string, IAppConfig, IConfig, IUserConfig, LoggerInterface, ICacheFactory),
which made documentserver_community fail to boot with a TypeError.

Detect the constructor arity at runtime and pass the matching arguments,
keeping compatibility with older connector versions (<= 10.0) and the
Nextcloud versions that ship them.

Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com>
@audioanton

Copy link
Copy Markdown

I have this exact issue too. The PR looks like a sensible fix.

@sjs6776

sjs6776 commented Jul 11, 2026

Copy link
Copy Markdown

Note the fix on line 96 of my file below, this allows docserver to work on NC34.
Credit to @defame-flagstick for the code to fix getConfig() being deprecated
Application.php

@NSO73

NSO73 commented Jul 13, 2026

Copy link
Copy Markdown
Author

Thanks @sjs6776 (and @defame-flagstick) — I've folded the getConfig() fix into the PR (commit c230ddf): \OC::$server->getConfig()\OC::$server->get(\OCP\IConfig::class), so it now also covers NC34.

Heads-up: I've since migrated to a native EuroOffice setup, so I won't be actively testing/maintaining this on my side anymore. I'm leaving the PR open in case it's useful to others and a maintainer wants to pick it up.

Resolve IConfig through the DI container instead of the deprecated
\OC::$server->getConfig(), which is gone on NC34. Same service, no
behaviour change. Credit to sjs6776 and defame-flagstick.

Signed-off-by: NSO73 <108399823+NSO73@users.noreply.github.com>
@NSO73 NSO73 force-pushed the fix/php84-and-connector-compat branch from c230ddf to fbc8112 Compare July 13, 2026 16:52
@blueforce

Copy link
Copy Markdown

This PR is also required for Nextcloud 34, not only for connector >= 10.1 — that might be worth reflecting in the title, since it's easy to miss.

On NC 34, OC\Server::getConfig() no longer exists. The two new AppConfig('onlyoffice', \OC::$server->getConfig(), ...) calls in Application.php therefore make the app fail to boot on every request:

Could not boot documentserver_community: Call to undefined method OC\Server::getConfig()

The visible result is HTTP 500 on /apps/documentserver_community/healthcheck, and the admin page shows "Error when trying to connect". Once that is fixed, the 6-parameter AppConfig constructor in connector 10.1.2 is the next blocker — which is exactly what buildAppConfig() here handles.

I ran into both on a production instance:

  • Nextcloud 34.0.1
  • PHP 8.3.31
  • onlyoffice connector 10.1.2
  • documentserver_community 0.2.4

To confirm the diagnosis I applied the equivalent change by hand (\OC::$server->get(\OCP\IConfig::class) plus the 6-argument constructor), not this exact branch. With that in place the app boots cleanly, /healthcheck returns true, and the boot errors disappear from the log. So I can confirm the root cause and that the fix direction is correct — but to be precise about scope: I have not run this branch verbatim, and I have not done a full editor regression test on NC 34.

One gap this PR doesn't cover: appinfo/info.xml still declares max-version="33", so even after this is merged the app won't be offered on NC 34 without a version bump.

@blueforce

Copy link
Copy Markdown

Update: I've now verified the editor itself on the same instance (Nextcloud 34.0.1, PHP 8.3.31, onlyoffice connector 10.1.2) — opening and editing .docx and .xlsx works cleanly, no errors in the log. The earlier caveat about the editor being untested no longer applies.

Still accurate: I'm running the equivalent fix applied by hand, not this branch verbatim.

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