You are here

public function JsonEncode::getLastError in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Encoder/JsonEncode.php \Symfony\Component\Serializer\Encoder\JsonEncode::getLastError()

Returns the last encoding error (if any).

Return value

int

Deprecated

since version 2.5, to be removed in 3.0. The {@self encode()} throws an exception if error found.

See also

http://php.net/manual/en/function.json-last-error.php json_last_error

File

vendor/symfony/serializer/Encoder/JsonEncode.php, line 40

Class

JsonEncode
Encodes JSON data.

Namespace

Symfony\Component\Serializer\Encoder

Code

public function getLastError() {
  @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 2.5 and will be removed in 3.0. Catch the exception raised by the encode() method instead to get the last JSON encoding error.', E_USER_DEPRECATED);
  return $this->lastError;
}