Support onlyoffice connector >= 10.1 and fix PHP 8.4 nullable deprecations#376
Support onlyoffice connector >= 10.1 and fix PHP 8.4 nullable deprecations#376NSO73 wants to merge 3 commits into
Conversation
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>
7315b9b to
335ce64
Compare
|
I have this exact issue too. The PR looks like a sensible fix. |
|
Note the fix on line 96 of my file below, this allows docserver to work on NC34. |
|
Thanks @sjs6776 (and @defame-flagstick) — I've folded the getConfig() fix into the PR (commit c230ddf): 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>
c230ddf to
fbc8112
Compare
|
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, The visible result is HTTP 500 on I ran into both on a production instance:
To confirm the diagnosis I applied the equivalent change by hand ( One gap this PR doesn't cover: |
|
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 Still accurate: I'm running the equivalent fix applied by hand, not this branch verbatim. |
What
Two fixes that let
documentserver_communityrun with the current ONLYOFFICE connector on recent PHP / Nextcloud.1. Support ONLYOFFICE connector >= 10.1 (AppConfig constructor change)
The
onlyofficeconnector 10.1 changedOCA\Onlyoffice\AppConfig::__constructfromto
With the old 4-argument call the app no longer boots:
buildAppConfig()now detects the constructor arity at runtime and passes thematching 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\IUserConfigonly exists on the newer ones).
2. PHP 8.4 — explicit nullable parameter types
PHP 8.4 deprecates implicitly nullable parameters (
Type $x = null). Made thenullable explicit (
?Type) for the$passwordparameters inDocumentConverter,ConverterBinaryandDocumentStore. No behaviour change; removes the deprecationwarnings logged on every document conversion.
Testing
Verified on Nextcloud 33.0.5 / PHP 8.4 with onlyoffice connector 10.1.0: the app
boots,
/healthcheckreturns 200, documents open and convert.