[wp-trac] [WordPress Trac] #49252: REST API response not valid for null on 5.3.2
WordPress Trac
noreply at wordpress.org
Mon Jan 20 19:36:55 UTC 2020
#49252: REST API response not valid for null on 5.3.2
--------------------------+-----------------------------
Reporter: jankadlec | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 5.3.2
Severity: major | Keywords:
Focuses: |
--------------------------+-----------------------------
There is one condition added that is preventing correct behaviour of REST
Expected behaviour:
when API call result is null for GET methods (where nothing is found
e.g.), should be encoded as null in JSON.
Actual behaviour:
when API call result is null, empty string is returned producting EOF
Error on receiving end.
in file wp-includes/rest-api/class-wp-rest-server.php line 404:
{{{#!php
<?php
// The 204 response shouldn't have a body.
if ( 204 === $code || null === $result ) {
return null;
}
}}}
should be fixed with:
{{{#!php
<?php
// The 204 response shouldn't have a body.
if ( 204 === $code ) {
return null;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49252>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list