Project

General

Profile

Actions

Bug #69368

closed

eID not recognized on POST requests

Added by Petra Arentzen over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Backend API
Target version:
Start date:
2015-08-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
easy
Is Regression:
Yes
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).

Actions #1

Updated by Markus Klein over 8 years ago

  • Description updated (diff)
  • Category set to Backend API
  • Priority changed from -- undefined -- to Must have
  • Target version set to 7.5
Actions #2

Updated by Markus Klein over 8 years ago

  • Description updated (diff)
Actions #3

Updated by Markus Klein over 8 years ago

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?

Actions #4

Updated by Markus Klein over 8 years ago

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.

Actions #5

Updated by Markus Klein over 8 years ago

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

Actions #6

Updated by Petra Arentzen over 8 years ago

Markus Klein wrote:

One more question. Does this work for you?

[...]

Mind the additional parenthesis.

Yes, that it. Argh, not seen that …

Actions #7

Updated by Gerrit Code Review over 8 years ago

  • 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

Actions #8

Updated by Markus Klein over 8 years ago

  • Complexity set to easy
  • Is Regression changed from No to Yes
  • Sprint Focus set to Stabilization Sprint
Actions #9

Updated by Gerrit Code Review over 8 years ago

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

Actions #10

Updated by Gerrit Code Review over 8 years ago

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

Actions #11

Updated by Markus Sommer over 8 years ago

  • Assignee set to Markus Klein
Actions #12

Updated by Markus Klein over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF