Bug #66763 [NEW]: always_populate_raw_post_data=0 BC issue with in-built web server
| From: | sixd@php.net | Date: | Mon, 24 Feb 2014 19:12:51 +0000 |
| Subject: | Bug #66763 [NEW]: always_populate_raw_post_data=0 BC issue with in-built web server | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-184396@lists.php.net to get a copy of this message | ||
From: sixd
Operating system: Linux
PHP version: 5.6Git-2014-02-24 (Git)
Package: Built-in web server
Bug Type: Bug
Bug description:always_populate_raw_post_data=0 BC issue with in-built web server
Description:
------------
Always_populate_raw_post_data=0 causes the in-built web server to
display a deprecatation warning. Backwards compatibility is broken
because headers are sent.
The warning should only ever be sent when
always_populate_raw_post_data=1
though this is debatable because any warning would break code similar to
the testcase.
Test script:
---------------
A testcase is based on
http://www.whitewashing.de/2014/01/31/soap_and_php_in_2014.html
Create these two files:
server.php
<?php
// server.php
class MyService
{
public function add($x, $y)
{
return $x + $y;
}
}
$options = array(
'uri' => 'http://localhost/namespace',
'location' => 'http://localhost:8899/server.php',
);
$server = new SOAPServer(null, $options);
$server->setObject(new MyService());
$server->handle();
?>
client.php:
<?php
// client.php
$options = array(
'uri' => 'http://localhost/namespace',
'location' => 'http://localhost:8899/server.php',
);
$client = new SOAPClient(null, $options);
echo $client->add(10, 10);
?>
Expected result:
----------------
Start the PHP 5.6 in-built webserver with:
$ php56 -d always_populate_raw_post_data=-1 -S 0.0.0.0:8899
or use PHP 5.5:
$ php55 -d always_populate_raw_post_data=0 -S 0.0.0.0:8899
Then execute the client in a terminal shell:
$ php56 client.php
The expected output of '20' is displayed.
Starting the PHP 5.6 server with always_populate_raw_post_data=0
should similarly allow client.php to work:
$ php56 -d always_populate_raw_post_data=0 -S 0.0.0.0:8899
Actual result:
--------------
With the default php.ini files, then either of these two PHP 5.6 cases
cause the test to fail. This is a BC break.
$ php56 -d always_populate_raw_post_data=0 -S 0.0.0.0:8899
or with the default php.ini value (which is
always_populate_raw_post_data=0):
$ php56 -S 0.0.0.0:8899
Then the client fails with the text:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got
no XML document in /home/cjones/public_html/soap/client.php:10
Stack trace:
#0 /home/cjones/public_html/soap/client.php(10):
SoapClient->__call('add', Array)
#1 /home/cjones/public_html/soap/client.php(10): SoapClient->add(10,
10)
#2 {main}
thrown in /home/cjones/public_html/soap/client.php on line 10
The web server displays:
[Mon Feb 24 10:56:46 2014] 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
[Mon Feb 24 10:56:46 2014] PHP Warning: Cannot modify header
information - headers already sent in Unknown on line 0
[Mon Feb 24 10:56:46 2014] PHP Warning: Cannot modify header
information - headers already sent in
/home/cjones/public_html/soap/server.php on line 20
[Mon Feb 24 10:56:46 2014] PHP Warning: Cannot modify header
information - headers already sent in
/home/cjones/public_html/soap/server.php on line 20
[Mon Feb 24 10:56:46 2014] 127.0.0.1:47848 [200]: /server.php
--
Edit bug report at https://bugs.php.net/bug.php?id=66763&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66763&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66763&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66763&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66763&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66763&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66763&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66763&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66763&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66763&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66763&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66763&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66763&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66763&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66763&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66763&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66763&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66763&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66763&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66763&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66763&r=mysqlcfg