[wp-trac] [WordPress Trac] #61580: WP_REST_Templates_Controller::get_wp_templates_author_text_field() doesn't always return value

WordPress Trac noreply at wordpress.org
Wed Jul 10 21:23:53 UTC 2024


#61580: WP_REST_Templates_Controller::get_wp_templates_author_text_field() doesn't
always return value
------------------------------+-----------------------------
 Reporter:  antonvlasenko     |       Owner:  hellofromTonya
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  6.7
Component:  REST API          |     Version:  trunk
 Severity:  minor             |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  rest-api
------------------------------+-----------------------------
Changes (by hellofromTonya):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"58705" 58705]:
 {{{
 #!CommitTicketReference repository="" revision="58705"
 REST API: Ensure string returned in
 WP_REST_Templates_Controller::get_wp_templates_author_text_field().

 Adds a fail-safe to return an empty string should the `switch` ever fall
 through without returning.

 Currently,
 `WP_REST_Templates_Controller::get_wp_templates_author_text_field()` is
 tightly coupled to
 `WP_REST_Templates_Controller::get_wp_templates_original_source_field()`.
 However, if the `$original_source` values change in either method, but not
 both, it is possible a `void` or `null` will be returned, rather than a
 `string`.

 Follow-up to [57366].

 Props antonvlasenko, hellofromTonya, debarghyabanerjee.
 Fixes #61580.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61580#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list