Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13173] Foundation.JSONEncoder + Swift 5.2.4 + .allowFragments difference between macOS and Linux #3248

ktoso opened this issue Jul 8, 2020 · 3 comments


Copy link

@ktoso ktoso commented Jul 8, 2020

Previous ID SR-13173
Radar rdar://problem/65213214
Original Reporter @ktoso
Type Bug
Status Resolved
Resolution Done

Ubuntu, Swift 5.2.4-RELEASE

Additional Detail from JIRA
Votes 1
Component/s Foundation
Labels Bug, Codable
Assignee None
Priority Medium

md5: 4e72ea41a8582e0940c613e2d3fc8e5f

Issue Description:

I'm aware and very happy that this was fixed on master and will be fixed in Swift 5.3: #2713 ( ).

Things are not in sync between corelibs foundation and foundation on 5.2.4 though, which causes us a bunch of painful workaround and headaches - is there a chance that the patch will also apply to any 5.2.x if/when there's going to be one?

macOS, swift 5.2.4, good:

Welcome to Apple Swift version 5.2.4 (swift-5.2.4-RELEASE).
 1> import Foundation
 3> JSONDecoder().decode(Int.self, from: "23".data(using: .utf8)!)
$R1: Int = 23

ubuntu, swift 5.2.4, bad:

Welcome to Swift version 5.2.4 (swift-5.2.4-RELEASE).
1> import Foundation
3> let s = JSONDecoder().decode(Int.self, from: "42".data(using: .utf8)!)
s: Int = 0 // oh oh...

Things are correct on Swift 5.3, however we're not really ready to require users to bump to that version, so we're stuck with building manually looking ahead at the bytes if it maybe it a top level value and trying to handle it "manually" today...

Copy link
Member Author

@ktoso ktoso commented Jul 8, 2020

@swift-ci create

Copy link
Member Author

@ktoso ktoso commented Jul 9, 2020

PRed a backport: #2840

Copy link
Member Author

@ktoso ktoso commented Sep 18, 2020

This was fixed in 5.2.5

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant