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

fromJSON() should not evaluate bson_error_t.message as boolean

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0
    • Affects Version/s: 1.1.8
    • Component/s: None
    • Labels:
      None

      In bson.c, fromJson calls phongo_throw_exception with either a custom error message, or a generic "Error parsing JSON" message.

      To determine whether or not to use a custom error message (bubbled up from mongoc) it checks whether a bson_error_t's message field is NULL. Since the message field is just an array, it is never NULL. This produces a warning on some compilers.

      To check if the bson_error_t has an error message, error.code or error.domain should be checked instead.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: