Skip to content

Fixes serialise() for NaN, Infinity, -Infinity and undefined#1188

Merged
lamweili merged 5 commits intomasterfrom
fixes-serialise()
Feb 20, 2022
Merged

Fixes serialise() for NaN, Infinity, -Infinity and undefined#1188
lamweili merged 5 commits intomasterfrom
fixes-serialise()

Conversation

@lamweili
Copy link
Copy Markdown
Contributor

@lamweili lamweili commented Feb 18, 2022

Fixes #1187

Task

  • Code change for single level
  • Code change for multi level (recursive)
  • Add test cases
  • Pass ESLint

Superseded by PR #1332.

@lamweili lamweili added this to the 6.4.2 milestone Feb 18, 2022
@lamweili lamweili added the bug Something isn't working label Feb 18, 2022
@lamweili lamweili force-pushed the fixes-serialise() branch 2 times, most recently from 22ee985 to 36a8a44 Compare February 20, 2022 17:30
@lamweili
Copy link
Copy Markdown
Contributor Author

lamweili commented Oct 1, 2022

Affected Components

Only affects clustering, multiprocessAppender, and tcpAppender.
These three will serialise() to String to transmit for the receiver to deserialise().

Code Object
(Input)
Serialised
(Transmission)
Deserialised
(Output)
Match
{"a": Number("abc")} {"a": NaN} {"a": "__LOG4JS_NaN__"} {"a": NaN} ✔️
{"b": 1/0} {"b": Infinity} {"b": "__LOG4JS_Infinity__"} {"b": Infinity} ✔️
{"c": -1/0} {"c": -Infinity} {"c": "__LOG4JS_-Infinity__"} {"c": -Infinity} ✔️
[undefined] [undefined] ["__LOG4JS_undefined__"] [undefined] ✔️

Updated by PR #1332.

@lamweili lamweili modified the milestone: 6.4.2 Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NaN needs to be handled here, otherwise JSON.stringfly will convert NaN to null below

1 participant