Bug #69368
closed
eID not recognized on POST requests
Added by Petra Arentzen over 9 years ago.
Updated over 7 years ago.
Sprint Focus:
Stabilization Sprint
Description
The problem seems to be in lines 111 to 113 in typo3/sysext/frontend/Classes/Http/EidRequestHandler.php:
$eID = isset($request->getParsedBody()['eID'])
? $request->getParsedBody()['eID']
: isset($request->getQueryParams()['eID']) ? $request->getQueryParams()['eID'] : '';
isset($request->getParsedBody()['eID'])
condition seams to be negative but $request->getParsedBody()['eID']
would return content. Maybe a bug in PHP, but at last it's not working for me.
Changing the lines to:
$eID = $request->getParsedBody()['eID'];
if (!isset($eID)) {
$eID = isset($request->getQueryParams()['eID']) ? $request->getQueryParams()['eID'] : '';
}
works.
I'm using TYPO3 7.4.0 with self-compiled PHP 5.6.12 on a Debian Jessie (Also tested with 5.5.28 with same result).
- Description updated (diff)
- Category set to Backend API
- Priority changed from -- undefined -- to Must have
- Target version set to 7.5
- Description updated (diff)
If this is the case, then this must be a PHP bug.
So we must change many places, where we use the same syntax. Can you maybe search whether this is a known bug, please?
One more question. Does this work for you?
$eID = isset($request->getParsedBody()['eID'])
? $request->getParsedBody()['eID']
: (isset($request->getQueryParams()['eID']) ? $request->getQueryParams()['eID'] : '');
Mind the additional parenthesis.
Ok the issue is indeed operator precedence.
From the PHP docs
// ternary operator associativity differs from C/C++
$a = true ? 0 : true ? 1 : 2; // (true ? 0 : true) ? 1 : 2 = 2
Markus Klein wrote:
One more question. Does this work for you?
[...]
Mind the additional parenthesis.
Yes, that it. Argh, not seen that …
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42891
- Complexity set to easy
- Is Regression changed from No to Yes
- Sprint Focus set to Stabilization Sprint
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42891
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42891
- Assignee set to Markus Klein
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF