Make WordPress Core


Ignore:
Timestamp:
11/23/2023 02:39:16 PM (13 months ago)
Author:
SergeyBiryukov
Message:

Tests: Avoid an infinite loop in Spy_REST_Server if a non-existing method is called.

Follow-up to [34928].

Props xknown, joemcgill.
Fixes #59601.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/spy-rest-server.php

    r55027 r57133  
    2626     */
    2727    public function __call( $method, $args ) {
     28        if ( ! method_exists( $this, $method ) ) {
     29            throw new Error( sprintf( 'Call to undefined method %s::%s()', get_class( $this ), $method ) );
     30        }
     31
    2832        return call_user_func_array( array( $this, $method ), $args );
    2933    }
Note: See TracChangeset for help on using the changeset viewer.