Page MenuHomePhabricator

Add a setup warning for "always_populate_raw_post_data"
ClosedPublic

Authored by epriestley on Aug 25 2016, 10:49 PM.
Tags
None
Referenced Files
F15455810: D16454.diff
Sun, Mar 30, 4:59 AM
F15450251: D16454.diff
Fri, Mar 28, 2:43 PM
F15438471: D16454.id.diff
Wed, Mar 26, 12:52 AM
F15437498: D16454.id39580.diff
Tue, Mar 25, 7:54 PM
F15433858: D16454.diff
Tue, Mar 25, 12:55 AM
F15388684: D16454.id39580.diff
Sat, Mar 15, 4:15 AM
F15376324: D16454.id39580.diff
Thu, Mar 13, 2:52 AM
F15327071: D16454.diff
Fri, Mar 7, 4:18 AM
Subscribers
None

Details

Summary

Fixes T9235. When the stars align, PHP 5.6 or newer emits a deprecation warning on startup about "always_populate_raw_post_data" which occurs too early for us to intercept and can break responses by adding garbage to the output.

These settings appear to be sufficient:

always_populate_raw_post_data = 1
display_errors = 1
display_startup_errors = 1
error_reporting = -1

Then make a request with an unusual content type:

$ curl -X POST -H "Content-Type: application/json" -d "{foo: bar}" http://phabricator.example.com/

This triggers the warning:

<br />
<b>Deprecated</b>:  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 <b>Unknown</b> on line <b>0</b><br />
<br />
...

To avoid this, just instruct administrators to set this value to "-1", which completely disables the feature and silences the warning.

Test Plan
  • Reproduced this issue by following the instructions above.
  • Triggered the setup issue locally and read all the captivating prose:

Screen Shot 2016-08-25 at 3.42.37 PM.png (1×1 px, 196 KB)

  • Made the configuration change it directed me to, saw the setup issue resolve.

Diff Detail

Repository
rP Phabricator
Branch
raw_post_data
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 13456
Build 17296: Run Core Tests
Build 17295: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Add a setup warning for "always_populate_raw_post_data".
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: jcox.
jcox edited edge metadata.
This revision is now accepted and ready to land.Aug 26 2016, 1:28 PM
This revision was automatically updated to reflect the committed changes.