Problem/Motivation

With 3.x, I'm seeing this error when returning a bool from a JSON-RPC method:

Exception TypeError: "Drupal\jsonrpc\Handler::doExecution(): Return value must be of type Drupal\jsonrpc\JsonRpcObject\Response|array|string|int|null, true returned" at /var/www/html/web/modules/contrib/jsonrpc/src/Handler.php line 194

However, I think this should be acceptable. I've posted to the JSON-RPC mailing list and will confirm.

Issue fork jsonrpc-3475910

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

Title: Response object type is too strict » Handler doExecution return type too strict

ptmkenny’s picture

According to Rast Lol on the JSON-RPC mailing list:

as per spec, it can be anything, including bool. also i don't know about PHP but js/json number type includes floating point numbers, not only integers. so if PHP makes a difference between int and, say, float/double, it should be there too

ptmkenny’s picture

ptmkenny’s picture

Title: Handler doExecution return type too strict » Handler doExecution return type should include bool and float

  • ptmkenny committed 037ce85c on 3.x
    Issue #3475910 by ptmkenny: Handler doExecution return type should...
ptmkenny’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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