Skip to content

Commit

Permalink
fix json serializing VersionComparer
Browse files Browse the repository at this point in the history
used in `passenger-config system-properties`

fixes #2565
  • Loading branch information
CamJN committed Oct 8, 2024
1 parent 031dc6c commit 9a1db68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Release 6.0.24 (Not yet released)
-------------
* Fix a regression from 6.0.10 where running `passenger-config system-properties` would throw an error. Closes GH-2565.
* [Ubuntu] Add packages for Ubuntu 24.10 "oracular".
* [Ruby] Specify rackup version to avoid broken 1.0 gem. Closes GH-2559.
* Upgrades Boost from 1.85 -> 1.86.
Expand Down
6 changes: 5 additions & 1 deletion src/ruby_supportlib/phusion_passenger/utils/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def generate(obj)
private

def generate_type(obj)
type = obj.is_a?(Numeric) ? :Numeric : obj.class.name
type = obj.is_a?(Numeric) ? :Numeric : obj.class.name.split('::').last
begin send(:"generate_#{type}", obj)
rescue NoMethodError; raise ArgumentError, "can't serialize #{type}"
end
Expand All @@ -170,6 +170,10 @@ def generate_String(str)
quote str.gsub(/[\r\n\f\t\b"\\]/) { "\\#{ESC_MAP[$&]}"}
end

def generate_VersionComparer(vc)
generate_String(vc)
end

def generate_simple(obj) obj.inspect end
alias generate_Numeric generate_simple
alias generate_TrueClass generate_simple
Expand Down

0 comments on commit 9a1db68

Please sign in to comment.