toJSON() should throw on invalid BSON

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 1.1.3
    • Affects Version/s: 1.1.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, MongoDB\BSON\toJSON() only throws if we cannot read exactly one document from the input stream.

      Corrupt BSON (e.g. flipping a field's type to the wrong byte) causes bson_as_json() to return NULL, which we simply return as an empty string. Instead, we should check for NULL and raise an exception.

            Assignee:
            Jeremy Mikola
            Reporter:
            Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: