Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-613

toJSON() should throw on invalid BSON

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.3
    • Affects Version/s: 1.1.2
    • Component/s: 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:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: