[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[ruby-core:78829] [Ruby trunk Bug#13070][Third Party's Issue] Parsing JSON with `quirks_mode: false` parses as if it is `true` and does not warn me.
From:
hsbt@...
Date:
2016-12-25 11:59:49 UTC
List:
ruby-core #78829
Issue #13070 has been updated by Hiroshi SHIBATA.
Status changed from Open to Third Party's Issue
Can you request it to [upstream repository](https://github.com/flori/json) ?
----------------------------------------
Bug #13070: Parsing JSON with `quirks_mode: false` parses as if it is `true` and does not warn me.
https://bugs.ruby-lang.org/issues/13070#change-62236
* Author: Josh Cheek
* Status: Third Party's Issue
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Previously you could parse toplevel strings in JSON by setting `quirks_mode` to `true`
```sh
$ ruby -rjson -v -e 'p JSON.parse JSON.dump("a"), quirks_mode: true'
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
"a"
```
If you set it to `false`, it would not parse them
```sh
$ ruby -rjson -v -e 'p JSON.parse JSON.dump("a"), quirks_mode: false'
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
/Users/josh/.rubies/ruby-2.3.1/lib/ruby/2.3.0/json/common.rb:156:in `parse': 784: unexpected token at '"a"' (JSON::ParserError)
from /Users/josh/.rubies/ruby-2.3.1/lib/ruby/2.3.0/json/common.rb:156:in `parse'
from -e:1:in `<main>'
```
In Ruby 2.4.0, it always parses them, no matter how I set `quirks_mode`, but it does not warn me that it is going to ignore my instruction to disallow this behaviour.
```sh
$ ruby -rjson -v -e 'p JSON.parse JSON.dump("a"), quirks_mode: true'
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
"a"
$ ruby -rjson -v -e 'p JSON.parse JSON.dump("a"), quirks_mode: false'
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
"a"
```
I think it should warn me as explicitly setting it to false implies that I rely on this behaviour (this was my case).
The changelog should probably also mention something about it, I didn't understand what had happened until I located [the commit](https://github.com/ruby/ruby/commit/1130658), looked up its references, realized the specification may have changed, and then checked the RFC.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>