× Requests and support related to jBackend.

PUT data lost on webservers with PHP < 5.6

  • pkottas
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 4 months ago #5864 by pkottas
jBackend does the following check to retrieve the api_key:

if (is_null($api_key))
{
// Get the input data as JSON
$json = new JInputJSON;
$json_data = json_decode($json->getRaw(), true);

The getRaw method of JInputJSON reads from the php://input stream (github.com/joomla/joomla-cms/blob/91749f845dcf20e097801ecd75da8e4665075a18/libraries/fof/input/jinput/json.php )

That means that for webservers that are on PHP < 5.6, the stream is now empty after reading the api key.
(See: php.net/manual/en/wrappers.php.php )

As such, all data is lost, and PUT methods cannot operate.

As a workaround, I am using a session variable to store the php://input data, by core hacking /components/com_jbackend/models/request.php

Please Log in or Create an account to join the conversation.

More
7 years 4 months ago #5868 by admin
Replied by admin on topic PUT data lost on webservers with PHP < 5.6
Thank for reporting this potential issue.

I will add a workaround for this issue in the next version.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #6052 by admin
Replied by admin on topic PUT data lost on webservers with PHP < 5.6
I just checked this issue from my todo list to fix it, and I have a question if you don't mind. Why do you need to hack the jBackend module and not just use $json->getRaw() by yourself?

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • pkottas
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #6055 by pkottas
Replied by pkottas on topic PUT data lost on webservers with PHP < 5.6
Because the jBackend uses the $json->getRaw() method earlier than my code (it uses it to check for existence of api_key and then passes control to my code), and thus empties the stream (remember this is for PHP < 5.6).

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #6058 by admin
Replied by admin on topic PUT data lost on webservers with PHP < 5.6
Ok, I got it now.
Unfortunately this requires a kind of patch / workaround like the one you already did, and PHP 5.6 is almost to its end-of-life. So there is no plan to implement it.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.144 seconds