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

doesn't fail when parsing "f" or "n" #58

Open
jmettraux opened this issue Apr 30, 2011 · 0 comments · May be fixed by #69
Open

doesn't fail when parsing "f" or "n" #58

jmettraux opened this issue Apr 30, 2011 · 0 comments · May be fixed by #69

Comments

@jmettraux
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant