php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67991 always_populate_raw_post_data deprecation warning buggy
Submitted: 2014-09-10 07:19 UTC Modified: 2014-10-27 13:00 UTC
From: felix dot hassert+phpbugs at sevenval dot com Assigned: salathe (profile)
Status: Closed Package: *Web Server problem
PHP Version: 5.6.0 OS: Debian Linux
Private report: No CVE-ID: None
 [2014-09-10 07:19 UTC] felix dot hassert+phpbugs at sevenval dot com
Description:
------------
http://www.php.net/manual/en/migration56.deprecated.php states, that a warning is triggered, if always_populate_raw_post_data is _enabled_. In my PHP.ini it is turned off:

always_populate_raw_post_data = Off

When I perform an _empty_ post request on any PHP file (even an empty one), the deprecation warning occurs in my logs:

PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

PHP version:

PHP 5.6.0 (cli) (built: Sep  3 2014 16:15:07) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies


Test script:
---------------
cd whereever-your-docroot-is/
touch test.php

curl -X POST 'http://127.0.0.1:8080/test.php'


Expected result:
----------------
no warning

Actual result:
--------------
log message:

PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-10 07:35 UTC] felix dot hassert+phpbugs at sevenval dot com
This seems to be related to https://wiki.php.net/rfc/slim_post_data (found via #66763). 

If I read the slim_post_data proposal correctly, I do understand, why this happens. In my case, no content-type is present. Thus the "always" in aprpd is different when using 0 or -1.

However, the 5.6 migration docs was misleading me, because I did not _enable_ the flag.
 [2014-09-10 10:56 UTC] mike@php.net
-Type: Bug +Type: Documentation Problem
 [2014-09-10 10:56 UTC] mike@php.net
It should read 
"... will now generate an E_DEPRECATED error when used" instead of 
"... will now generate an E_DEPRECATED error when enabled"

The "enabled" was taken from UPGRADING, sorry.
 [2014-10-26 16:29 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=335142
Log: auto_populate_raw_post_data generates E_DEPRECATED when *used* (doc bug #67991)
 [2014-10-26 16:29 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 [2014-10-26 16:29 UTC] salathe@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-10-26 16:30 UTC] salathe@php.net
Oops, wrong "quick fix" message...

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2014-10-27 13:00 UTC] tyrael@php.net
I'm not sure that the reworded sentence is better.
If I had to guess based on "will now generate an <constant>E_DEPRECATED</constant> error when used", I would think that I should remove every reference for always_populate_raw_post_data from my config/code to make this message to go away, which is not true.

I think it would be better to describe what is actually happening:
the E_DEPRECATED will be generated when $HTTP_RAW_POST_DATA is populated which controlled by the value of always_populate_raw_post_data (link to http://php.net/manual/en/ini.core.php where we already describe in which case will $HTTP_RAW_POST_DATA be populated) and to remove the deprecated message make sure that you don't use $HTTP_RAW_POST_DATA but php://input then you can disable the population of $HTTP_RAW_POST_DATA via setting always_populate_raw_post_data to -1, which will remove the E_DEPRECATED.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 11:01:29 2024 UTC