weixin_39604139 2020-11-20 20:54
浏览 0

Parser potential problem

Regarding: https://github.com/neomerx/json-api/blob/master/src/Encoder/Parser/Parser.php

One model suddenly stopped working with using SELF::DATA output from the schema class. The relevant error in laravel log was: *[2018-02-20 08:48:18] local.ERROR: data {"exception":"[object] (InvalidArgumentException(code: 0): data at D:\Frameworks\XAMPP\htdocs\projectx\vendor*

The relevant code that throws the exception is: $isOk = (is_array($data) === true || is_object($data) === true || $data === null); $isOk ?: Exceptions::throwInvalidArgument('data', $data);

Upon closer examination the $data is sometimes populated by an Integer value (number 1) which triggers the exception.

The data is coming from: /** * array|null|object */ protected function getCurrentData() { $relationship = $this->stack->end()->getRelationship(); $data = $relationship->isShowData() === true ? $relationship->getData() : null; return $data; }

and

/** * array */ protected function analyzeCurrentData() { $data = $this->getCurrentData(); $result = $this->analyzeData($data); return $result; }

Is this somekind of bug ?

该提问来源于开源项目:neomerx/json-api

  • 写回答

0条回答 默认 最新

    报告相同问题?