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

php_phongo_dispatch_handlers() should break if exception is thrown

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.5.0
    • Affects Version/s: None
    • Component/s: None
    • None

      php_phongo_dispatch_handlers() currently iterates over all registered subscribers and invokes event handlers using zend_call_method(). In the event that an exception is thrown from an event handler, we rely on zend_call_function() to no-op; however, we will continue to loop through the subscribers and make repeated calls to zend_call_method().

      If the exception is thrown during a command started handler, php_phongo_dispatch_handlers() will still be called for the subsequent command succeeded/failed event and make additional zend_call_method() calls, which will again no-op.

      It would be prudent to check for an exception before calling zend_call_method() in php_phongo_dispatch_handlers() and break out of the subscriber iteration so that we can return early.

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: