[
https://issues.apache.org/jira/browse/THRIFT-5770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081255#comment-18081255
]
Volodymyr Panivko commented on THRIFT-5770:
-------------------------------------------
Resolved in master: TJSONProtocol and TSimpleJSONProtocol now encode NaN and
+/-Infinity as the quoted JSON tokens "NaN", "Infinity", "-Infinity" (matching
the Java and C++ implementations). Constants TOKEN_NAN / TOKEN_POS_INFINITY /
TOKEN_NEG_INFINITY live on TJSONProtocol, plus regression coverage in
lib/php/test/Unit/Lib/Protocol/TJSONProtocolTest.php and
TSimpleJSONProtocolTest.php.
> Inf and Nan values does not encoded in php library
> --------------------------------------------------
>
> Key: THRIFT-5770
> URL: https://issues.apache.org/jira/browse/THRIFT-5770
> Project: Thrift
> Issue Type: Bug
> Components: PHP - Library
> Affects Versions: 0.20.0
> Reporter: Volodymyr Panivko
> Priority: Major
>
> Methods \Thrift\Protocol\TJSONProtocol::writeJSONDouble and
> \Thrift\Protocol\TSimpleJSONProtocol::writeJSONDouble uses for value encoding
> function
> json_encode which give an error "Inf and NaN cannot be JSON encoded". Because
> json_encode does not throw exception code works. This error can be seen by
> function json_last_error_msg or if flag THROW_ERROR_ON_EXCEPTION will be
> provided to json_encode
> Founded during writing tests for php library
> https://github.com/apache/thrift/pull/2951/files#r1536763203
--
This message was sent by Atlassian Jira
(v8.20.10#820010)