RSS Feed/News XF\Http\Request: Non-array-like JSON input triggers PHP error

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
30,210
Points
823

Reputation:

To reproduce, send JSON input to XenForo that PHP's json_decode function does not turn into an array (but into a string/int/boolean/...). For example:
Code:

curl -X POST -H "Content-Type: application/json" -d "true" https://xenforo.com/community/

Then XF\Http\Request::getPhpInputJson returns a scalar value (instead of an array) which causes the following error in XF\Http\Request::__construct:
Code:

Uncaught TypeError: Unsupported operand types: array + bool...

Read more

Continue reading...
 
Status
Not open for further replies.
Top