Skip to content

[NC 33] TypeError: getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given on Certificate Revocation #7495

@stanthblt

Description

@stanthblt

Describe the bug

In Nextcloud 33.0.2 (AIO), attempting to revoke a certificate from the "Certificate Management" section results in an immediate Fatal TypeError. It seems strict typing in NC33/PHP is catching a null value being passed where a string is expected for the $instanceId.

To reproduce

Steps to reproduce the behavior:

  1. Upgrade to Nextcloud 33.0.2 (using AIO).
  2. Go to LibreSign > Certificate Management.
  3. Attempt to revoke an existing certificate.
  4. The action fails and the system logs a TypeError.

Expected behavior

The certificate should be successfully revoked without throwing a PHP type error.

Screenshots

{"reqId":"ltnIWmyhVCfIiqNgxx30","level":3,"time":"2026-04-10T12:28:18+00:00","remoteAddr":"78.241.83.45","user":"admin","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/libresign/api/v1/crl/revoke","scriptName":"/ocs/v2.php","message":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71 in file '/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php' line 240","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36","version":"33.0.2.2","exception":{"Exception":"Exception","Message":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71 in file '/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php' line 240","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Libresign\Controller\CrlApiController"},"revoke"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Libresign\Controller\CrlApiController","revoke",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"ocs.libresign.crlapi.revoke","apiVersion":"v1"}]},{"file":"/var/www/html/ocs/v1.php","line":61,"function":"match","class":"OC\Route\Router","type":"->","args":["/ocsapp/apps/libresign/api/v1/crl/revoke"]},{"file":"/var/www/html/ocs/v2.php","line":8,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":150,"Previous":{"Exception":"TypeError","Message":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php","line":71,"function":"getNextCrlNumber","class":"OCA\Libresign\Service\Crl\CrlService","type":"->","args":[null,null,"openssl"]},{"file":"/var/www/html/custom_apps/libresign/lib/Controller/CrlApiController.php","line":132,"function":"revokeCertificate","class":"OCA\Libresign\Service\Crl\CrlService","type":"->","args":["1722754566",{"class":"OCA\Libresign\Enum\CRLReason","name":"UNSPECIFIED","value":0},null,"admin"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":205,"function":"revoke","class":"OCA\Libresign\Controller\CrlApiController","type":"->","args":["1722754566",0,null]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Libresign\Controller\CrlApiController"},"revoke"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Libresign\Controller\CrlApiController"},"revoke"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Libresign\Controller\CrlApiController","revoke",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"ocs.libresign.crlapi.revoke","apiVersion":"v1"}]},{"file":"/var/www/html/ocs/v1.php","line":61,"function":"match","class":"OC\Route\Router","type":"->","args":["/ocsapp/apps/libresign/api/v1/crl/revoke"]},{"file":"/var/www/html/ocs/v2.php","line":8,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php","Line":240},"message":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71 in file '/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php' line 240","exception":"{"class":"Exception","message":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71 in file '/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php' line 240","code":0,"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php:150","trace":"#0 /var/www/html/lib/private/AppFramework/App.php(153): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Libresign\Controller\CrlApiController), 'revoke')\n#1 /var/www/html/lib/private/Route/Router.php(321): OC\AppFramework\App::main('OCA\\Libresign\\C...', 'revoke', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)\n#2 /var/www/html/ocs/v1.php(61): OC\Route\Router->match('/ocsapp/apps/li...')\n#3 /var/www/html/ocs/v2.php(8): require_once('/var/www/html/o...')\n#4 {main}","previous":{"class":"TypeError","message":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71","code":0,"file":"/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php:240","trace":"#0 /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php(71): OCA\Libresign\Service\Crl\CrlService->getNextCrlNumber(NULL, NULL, 'openssl')\n#1 /var/www/html/custom_apps/libresign/lib/Controller/CrlApiController.php(132): OCA\Libresign\Service\Crl\CrlService->revokeCertificate('1722754566', Object(OCA\Libresign\Enum\CRLReason), NULL, 'admin')\n#2 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(205): OCA\Libresign\Controller\CrlApiController->revoke('1722754566', 0, NULL)\n#3 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(118): OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Libresign\Controller\CrlApiController), 'revoke')\n#4 /var/www/html/lib/private/AppFramework/App.php(153): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Libresign\Controller\CrlApiController), 'revoke')\n#5 /var/www/html/lib/private/Route/Router.php(321): OC\AppFramework\App::main('OCA\\Libresign\\C...', 'revoke', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)\n#6 /var/www/html/ocs/v1.php(61): OC\Route\Router->match('/ocsapp/apps/li...')\n#7 /var/www/html/ocs/v2.php(8): require_once('/var/www/html/o...')\n#8 {main}"}}","CustomMessage":"OCA\Libresign\Service\Crl\CrlService::getNextCrlNumber(): Argument #1 ($instanceId) must be of type string, null given, called in /var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php on line 71 in file '/var/www/html/custom_apps/libresign/lib/Service/Crl/CrlService.php' line 240"},"id":"69d907ffead23"}

Environment information

  • Nextcloud version: 33.0.2 (All-in-One)
  • LibreSign version: 13.2.2
  • PHP version: 8.3.30

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    0. Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions