doesn't fail when parsing "f" or "n"
Opened this issue · 0 comments
jmettraux commented
when parsing "f" and "n", yajl-ruby returns nil (instead of emitting an error).
(https://gist.github.com/949695)
require 'rubygems'
require 'yajl'
require 'yajl/version'
require 'json'
puts `uname -a`
p [ :ruby, RUBY_VERSION ]
p [ :json, JSON::VERSION ]
p [ :yajl, Yajl::VERSION ]
p begin
JSON.parse('f')
rescue
:json_error
end
p begin
JSON.parse('n')
rescue
:json_error
end
p begin
Yajl::Parser.parse('f')
rescue
:yajl_error
end
p begin
Yajl::Parser.parse('n')
rescue
:yajl_error
end
emits
Darwin sanma.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386
[:ruby, "1.9.2"]
[:json, "1.4.2"]
[:yajl, "0.8.2"]
:json_error
:json_error
nil
nil
Tested with 1.8.7-p249 and 1.9.2-p180 on Snow Leopard. Using vanilla RVM.
Same thing on a Debian system (vanilla RVM) :
Linux li162-226 #1 SMP Sun Jul 25 21:32:42 UTC 2010 i686 GNU/Linux
[:ruby, "1.8.7"]
[:json, "1.5.1"]
[:yajl, "0.8.2"]
:json_error
:json_error
nil
nil
Kind regards.