Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-347

Use error suppression when triggering deprecation warnings

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      a.braun@voycer.com brought this up in mongodb/mongo-php-library#533 (PHPLIB-346) after we added trigger_error() calls for deprecation notices. If we suppress those calls with the @ operator, we would avoid polluting stdout while still allowing custom handlers to be notified. Frameworks such as Symfony register custom handlers to capture warnings and notices for logging.

      Without suppressing our own trigger_error() calls, we leave users no way to suppress these errors without asking them to suppress the call into PHPLIB. Since our notices are emitted a few levels deeper than their entry point (e.g. collection method), that results in a fairly broad suppression.

      See symfony/symfony#14900 for additional discussion about this.

      If we decide to do this for PHPLIB, we should also consider if we can reach an equivalent approach in PHPC for PHPC-1137 and PHPC-1138.

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

              Created:
              Updated:
              Resolved: