Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

#34915 closed enhancement (fixed)

Consider suppressing error notices for REST API requests

Reported by: danielbachhuber's profile danielbachhuber Owned by: rachelbaker's profile rachelbaker
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: REST API Keywords: good-first-bug has-patch
Focuses: Cc:

Description

We should consider suppressing error notices for REST API requests, as they can break the response.

Originally https://github.com/WP-API/WP-API/issues/477

Attachments (3)

34915.patch (482 bytes) - added by rockwell15 9 years ago.
34915.2.patch (482 bytes) - added by rockwell15 9 years ago.
34915.3.patch (530 bytes) - added by rockwell15 9 years ago.

Download all attachments as: .zip

Change History (15)

#1 follow-up: @chriscct7
9 years ago

I actually like that they break responses right now, because it makes it easier to find bugs. If the concern is breaking responses for a production server, they could turn off notices in their PHP.ini file (which should be done on production anyways)

#2 in reply to: ↑ 1 @pathartl
9 years ago

Replying to chriscct7:

I actually like that they break responses right now, because it makes it easier to find bugs. If the concern is breaking responses for a production server, they could turn off notices in their PHP.ini file (which should be done on production anyways)

If this type of thing were to be considered, I would think it would make more sense to have it controlled by WP_DEBUG. Those on hosted solutions wouldn't have control over it if it were in PHP.ini and it doesn't really make sense to separate it out from WordPress.

#3 @DrewAPicture
9 years ago

  • Keywords good-first-bug added

Looks like piggybacking on wp_debug_mode() would be the way to go, similarly, as @nacin pointed out on GitHub, to how we suppress notices for XMLRPC requests.

#4 @SergeyBiryukov
9 years ago

  • Milestone changed from Future Release to 4.5

Related: #26262

@rockwell15
9 years ago

#5 @rockwell15
9 years ago

Does that work well?

#6 @rachelbaker
9 years ago

  • Keywords needs-refresh added; needs-patch removed

@rockwell15 Thanks for your patch. It looks good, but can you refresh it to be against the svn root directory?

The location of the file being patched here should be src/wp-includes/load.php.

@rockwell15
9 years ago

@rockwell15
9 years ago

#7 @rockwell15
9 years ago

  • Keywords has-patch added; needs-refresh removed

This ticket was mentioned in Slack in #core-restapi by rachelbaker. View the logs.


9 years ago

#9 @rachelbaker
9 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to closed

In 36530:

REST API: Don’t display errors during REST API requests.

Uses wp_debug_mode() to prevent response from being broken by debug errors. Matches similar behavior of the XML-RPC API.

Props rockwell15.

Fixes #34915.

#10 @ocean90
9 years ago

In 36571:

Don't display errors during Ajax requests.

See #34915 for REST and #23811 for XML-RPC.

Props pento.
Fixes #26262.

This ticket was mentioned in Slack in #core-restapi by borekb. View the logs.


8 years ago

This ticket was mentioned in Slack in #core-restapi by chrisl27. View the logs.


6 years ago

Note: See TracTickets for help on using tickets.