[wp-trac] [WordPress Trac] #44304: API will create PHP warning and thus break code on empty category
WordPress Trac
noreply at wordpress.org
Wed Nov 6 02:49:46 UTC 2019
#44304: API will create PHP warning and thus break code on empty category
--------------------------+------------------------
Reporter: apermo | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: REST API | Version: 4.7
Severity: minor | Resolution: duplicate
Keywords: has-patch | Focuses:
--------------------------+------------------------
Changes (by TimothyBlynJacobs):
* status: new => closed
* version: 4.9.6 => 4.7
* resolution: => duplicate
* milestone: Awaiting Review =>
Comment:
Hi @apermo, apologies for the delay in responding to your ticket.
I haven't been able to replicate your issue. The following unit test does
not appear to generate any PHP warnings. I think this has been fixed by
#43977. Feel free to reopen if you are still encountering an issue.
{{{#!php
<?php
/**
* @ticket 44304
*/
public function
test_create_item_does_not_issue_warning_when_terms_is_empty_string() {
wp_set_current_user( self::$editor_id );
$request = new WP_REST_Request( 'POST', '/wp/v2/posts' );
$request->add_header( 'content-type', 'application/x-www-
form-urlencoded' );
$params = $this->set_post_data( array( 'categories' => ''
) );
$request->set_body_params( $params );
$response = rest_get_server()->dispatch( $request );
$this->assertCount( 0, $response->get_data()['categories']
);
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44304#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list