Behat / WebApiExtension

Behat extension to test web APIs
http://extensions.behat.org
MIT License
111 stars 114 forks source link

Automatically populating $HTTP_RAW_POST_DATA is deprecated #61

Closed Spomky closed 8 years ago

Spomky commented 8 years ago

Hi,

I have the following error when I run tests of this extension.

      │ --- Failed steps:
      │ 
      │     And the response should contain json: # features/send_raw.feature:16
      │       Can not convert actual to json:
      │       <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 />
      │       <b>Warning</b>:  Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br />
      │       {"warning":"Do not expose this service in production : it is intrinsically unsafe","method":"POST","name":"name","pass":"pass","headers":{"user-agent":["GuzzleHttp\/6.2.1 curl\/7.22.0 PHP\/5.6.5"],"host":["localhost:8080"],"content-type":["application\/json"],"content-length":["35"],"x-php-ob-level":[1]},"query":[]} (Assert\InvalidArgumentException)
stof commented 8 years ago

The extension does not rely on the deprecation feature. you can turn it off in your php.ini (there is no way to avoid the deprecation warning if the feature is turned on, even though you never read $HTTP_RAW_POST_DATA, as the warning is triggered very early in the request processing)

stof commented 8 years ago

and we cannot change the ini setting ourselves either, as it would be too late (the processing of the input request happens before calling the userland code)

Spomky commented 8 years ago

OK thanks. In fact it works fine on my production server but not on the travis-ci platform. I will investigate according to your comments.