Problem/Motivation

When using this module with PHP 8.2, there are some deprecation notices:

Deprecated function: Creation of dynamic property Drupal\jsonrpc\Annotation\JsonRpcMethod::$output is deprecated in Drupal\Core\Cache\ApcuBackend->getMultiple() (line 90 of core/lib/Drupal/Core/Cache/ApcuBackend.php).
Drupal\Core\Cache\ApcuBackend->getMultiple(Array, ) (Line: 141)
Drupal\Core\Cache\ChainedFastBackend->getMultiple(Array, ) (Line: 103)
Drupal\Core\Cache\ChainedFastBackend->get('jsonrpc_plugins') (Line: 37)
Drupal\Core\Plugin\DefaultPluginManager->cacheGet('jsonrpc_plugins') (Line: 213)
Drupal\Core\Plugin\DefaultPluginManager->getCachedDefinitions() (Line: 179)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 22)
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('user.verify_email', ) (Line: 117)
Drupal\jsonrpc\Handler->getMethod('user.verify_email') (Line: 101)
Drupal\jsonrpc\Handler->supportsMethod('user.verify_email') (Line: 128)
Drupal\jsonrpc\Shaper\RpcRequestFactory->denormalizeParams(Array, Object) (Line: 110)
Drupal\jsonrpc\Shaper\RpcRequestFactory->denormalizeRequest(Array, Object) (Line: 88)
Drupal\jsonrpc\Shaper\RpcRequestFactory->Drupal\jsonrpc\Shaper\{closure}(Array)
array_map(Object, Array) (Line: 87)
Drupal\jsonrpc\Shaper\RpcRequestFactory->doTransform(Array, Object) (Line: 33)
Shaper\Transformation\TransformationBase->transform(Array, Object) (Line: 214)
Drupal\jsonrpc\Controller\HttpController->getRpcRequests(Object) (Line: 152)
Drupal\jsonrpc\Controller\HttpController->resolve(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Call a JSON:RPC operation with PHP 8.2.

Proposed resolution

Eliminate the deprecation notice.

Issue fork jsonrpc-3391824

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ptmkenny created an issue. See original summary.

ptmkenny’s picture

Status: Active » Needs review

Declaring the property fixes the issue for me, but I'm not sure if my comment is correct. Tentatively setting to NR.

cspitzlay made their first commit to this issue’s fork.

cspitzlay’s picture

@ptmkenny: Regarding the question in #3 about the comment above the property:
I think your stacktrace is from a reviving such an object while fetching it from cache.

The only write access to this property I could find in regular code is in:
Drupal\jsonrpc\Plugin\JsonRpcMethodManager->alterDefinitions()
and that is where I got this deprecation message.

It looks to me as if it was the output schema that went into that property.

I will amend the comment accordingly and adapt the type to match the return type of \Drupal\jsonrpc\Plugin\JsonRpcMethodBase::outputSchema() which is where the value that is written comes from.

ptmkenny’s picture

ptmkenny’s picture

  • ptmkenny committed e21b2411 on 2.x
    Issue #3391824 by ptmkenny, cspitzlay: PHP 8.2 compatibility
    
ptmkenny’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.