I'm using what I believe to be pretty standard code in a Drupal 8 module to return serialized data:

  /**
   * Responds to producer resource GET requests.
   * @return \Drupal\rest\ResourceResponse
   */
  public function get() {
    $data = $this->get_inventory_list();
    $response = new ResourceResponse($data['response_data']);
    $response->addCacheableDependency($data['response_data']);
    if ($data['cache']) {
      $response->addCacheableDependency($data['cache']);
    }
    return $response;
  }

When using json_decode($data->contents, FALSE); to decode the response, the result is an object of objects, which causes a fatal error on line 313 of views_json_query_plugin_query_json.inc, when it attempts to slice the outer object.

Easest and least intrusive fix seems to be casting $rows as an array on line 278. I'll put a patch up shortly.

CommentFileSizeAuthor
#2 cast-rows-as-array-2975063-2.patch517 byteswrd

Comments

wrd created an issue. See original summary.

wrd’s picture

StatusFileSize
new517 bytes