get_name() ); if ( ! class_exists( 'WP_Filter_Sentinel' ) ) { // Pre-7.1 core: wp_ability_invoked will never fire for this call, so open the same // pending row here ourselves, before parent::execute() does any work. See the class // docblock above for why this check gates cleanly on every core this plugin supports. aafm_open_pending_invocation_row( $this->get_name(), $input ); } // Captured so the finally below can decide, from what parent::execute() actually // returned, whether a still-dangling row names a real core refusal or must stay exactly // where the call left it. Stays null if parent::execute() never returns at all (an // uncaught Throwable from an unwrapped core filter) - aafm_core_input_rejection_code() // treats null as "nothing to recognise", so that path is unaffected by this change. $result = null; aafm_executing_ability_push( $this->get_name() ); try { $result = parent::execute( $input ); return $result; } finally { aafm_executing_ability_pop(); if ( null === aafm_executing_ability() ) { aafm_refresh_after_meta_writes(); } aafm_rate_limit_call_reset( $this->get_name() ); aafm_resolve_dangling_invocation_if_mine( $this->get_name(), $invocation_token, $result ); } } /** * Validate a result against the output schema, except for a bridged wrapper. * * A bridged wrapper fronts someone else's ability. Its execute callback calls the source's own * execute(), which has already validated the result under the source's own class rules, and a * violation comes back as that ability's WP_Error. Checking the same data again against the * schema copied onto the wrapper turned a source that skips validation on purpose (ACF's REST * abilities) into a spurious ability_invalid_output after the change had landed. A source that keeps * core's check keeps its advertised schema and only the second check is skipped; one that skips its * own check has no schema advertised (aafm_register_enabled_bridged_abilities()). Native abilities * keep core's validation. * * @param mixed $output The ability's result. * @return true|\WP_Error */ protected function validate_output( $output ) { if ( str_starts_with( $this->get_name(), AAFM_BRIDGE_NAMESPACE . '/' ) ) { return true; } return parent::validate_output( $output ); } }