[wp-trac] [WordPress Trac] #31806: PHP Deprecated: $HTTP_RAW_POST_DATA

WordPress Trac noreply at wordpress.org
Fri May 10 19:14:36 UTC 2019


#31806: PHP Deprecated: $HTTP_RAW_POST_DATA
--------------------------+-----------------------
 Reporter:  jack772015    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:
Component:  REST API      |     Version:  4.1.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------
Changes (by sc0ttkclark):

 * status:  closed => reopened
 * resolution:  invalid =>
 * component:  General => REST API


Comment:

 Reopening this since it's referenced in WP_REST_Server::get_raw_data() as
 of WP 4.4. Still seeing this error sometimes happening, which WooCommerce
 may have found a way around it at one point with their legacy REST API
 endpoints using the following code above the `$HTTP_RAW_POST_DATA` usage:

 {{{#!php
 <?php
 // $HTTP_RAW_POST_DATA is deprecated on PHP 5.6.
 if ( function_exists( 'phpversion' ) && version_compare( phpversion(),
 '5.6', '>=' ) ) {
         return file_get_contents( 'php://input' );
 }
 }}}

 Should a similar fix be considered in core now that PHP 5.6+ is the
 requirement and this error will trigger on 5.6.x unless you are running
 7.0+?

 Asking because I'm seeing this crop up on certain sites which causes WP
 5.x editor save failures (using default Gutenberg editor) with certain
 blocks that have more data to submit to the WP Posts REST API.

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


More information about the wp-trac mailing list