Bug #78338

ValueObject as parameter in UriBuilder results in uid & pid declaration

Added by Alexander Buch about 5 years ago. Updated about 5 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2016-10-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Passing a ValueObject as argument to one of the Fluid ViewHelpers for URI-handling will lead to (empty) uid- and pid-declarations in the resulting URI.
This in turn can blow up the property-mapper when it's trying to map the URL's parameters to the method's/action's arguments.

From my point of view the issue happens within `convertTransientObjectToArray()` of \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder as it just takes no care at all about uid and pid but instead just takes every object property:

https://github.com/TYPO3/TYPO3.CMS/blob/7254650107f48732b963d5ef8c6838bdd02ff1bd/typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php#L828

One could argue that uid and pid don't belong in a ValueObject...
but `AbstractValueObject` extends `AbstractDomainObject` and this already declares uid and pid as a property (whyyy).

As the AbstractValueObject<->AbstractDomainObject constellation is an open mis(t)ery to me, I suggest to take special care of the uid and pid properties within the aforementioned `convertTransientObjectToArray()` implementation.

Thanks.

#1

Updated by Alexander Buch about 5 years ago

Just for the reference, as a workaround i unset uid and pid in the constructor of my ValueObject:

    public function __construct()
    {
        unset($this->uid);
        unset($this->pid);
    }

Also available in: Atom PDF