-
-
Notifications
You must be signed in to change notification settings - Fork 90
Add raw body storing #67
Comments
Hi @IvanDelsinne, Oh, ok, I see the notice now "Note: Prior to PHP 5.6, a stream opened with php://input could only be read once; the stream did not support seek operations.". Yeah, would be nice to have it in memory for further reading. |
I just noticed that it was only prior PHP5.6, so it was a mistake I made to think that it still worked that way. That'll teach me to read and test! (Actually I tested, but on an old PHP server we got at Uni, which is using PHP5.3). Now I'm wondering... Should I implement it, to keep compatibility with such old versions or just close the issue and just keep this info. in my head ? |
Support for 5.5 ended in July 2016. I really don't think we should bother about compatibility with versions bellow 5.6. |
Understood. Also my servers are all using PHP7.1.8 and I'm painfully waiting for the PHP7.2 release, the server I was talking about is the server hosting most websites in our university and they use so much old stuff an update (even to PHP5.4) would break most of the website... (it's both sad and scary). |
When using siler for a website, and assuming the request is only sent by a form using either
application/x-www-form-urlencoded
ormultipart/form-data
, PHP parses the request body and populates the $_POST variable with parse results.If it doesn't recognise the Content-Type of the request or if it's incorrectly set, PHP will fail to parse without a warning and will only give an empty $_POST.
Such behaviour would be expected when using Siler as a backend API, receiving and sending back JSON (e.g. with the JSONP request format).
For that, the trick is to read from
php://input
but that can only be done 1 time (source). For now, the Request::raw method does the trick, but only one time.I'll work on the Request.php file to add lazy retrieving/global storing to avoid data loss when reading multiple times.
The text was updated successfully, but these errors were encountered: