mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
This API had rather peculiar behavior in case the provided function is not callable. For some types of failures, it would silently return FAILURE (e.g. a function does not exist), while for others (e.g. a class does not exist) it would generate a warning. Depending on what the calling code does, this can either result in silent failure or duplicate errors. This commit switches the contract such that zend_call_function() always (*) succeeds, though that success might be in the form of throwing an exception. Calling a non-callable will now consistently throw an exception. There are some rare callers that do want to ignore missing methods, for legacy APIs that are specific with optional methods. For these use cases a new zend_call_method_if_exists() API is provided. Calling code generally does not need to explicitly check for and report zend_call_function() failures -- it can rely on zend_call_function() having already done so. However, existing code that does check for failure should continue to work fine. (*) The only exception to this is if EG(active) being false during late engine shutdown. This is not relevant to most code, but code running in destructors and similar may need to be aware of the possibility.