Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2024

as_json improperly handles some attribute names

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.11
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      If you have a document that has a dynamic field called 'loop', and you call as_json on it, it will convert the attribute value into an enumerator. If you declare 'loop' as a field, it is treated correctly.

      The issue is in serializable_hash of serialization.rb, where it uses send to find the value of the attribute. In this case loop is a method and so its result, an enumerator, gets returned instead of the attribute value. If you then call to_json, or as_json again, on the result, it will go into an infinite loop.

            Assignee:
            Unassigned Unassigned
            Reporter:
            darend Daren Desjardins
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: