FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
190 stars 229 forks source link

v:page.resources.fal returns empty array when no limit is specified #1828

Closed binaryfs closed 11 months ago

binaryfs commented 1 year ago

Hello,

as already mentioned in the title, the v:page.resources.fal ViewHelper returns an empty array when no limit is specified:

<v:page.resources.fal table="pages" field="media" uid="{someUid}" as="images">
    <!-- {images} is an empty array -->
</v:page.resources.fal>

With limit everything works fine:

<v:page.resources.fal table="pages" field="media" uid="{someUid}" as="images" limit="1">

This is caused by the SlideViewHelperTrait. If no limit is given, $limit will be null in this method:

protected function getSlideRecords($pageUid, $limit = null)
{
    if (null === $limit && false === empty($this->arguments['limit'])) {
        $limit = (integer) $this->arguments['limit'];
    }

And thus the following condition evaluates to true, even though it shouldn't:

if (0 !== $limit) {

This behavior was introduced in 6.1.3. My current workaround is to always set a limit in the ViewHelper.

Best regards

olegkarun commented 1 year ago

Same for me

Oktopuce commented 1 year ago

Same problem for me with TYPO3 V11 and PHP 8.

fischhase commented 1 year ago

same with V11 and PHP 7.4

ursbraem commented 1 year ago

Same with TYPO3 10.4.34 and PHP 7.4

wrack commented 1 year ago

I have create a pull request: https://github.com/FluidTYPO3/vhs/pull/1840

NamelessCoder commented 11 months ago

Fixed since 9b64157959d6237efd8d4d8c0aeb510e10b9fc36 and 3b4c8e04649ad9de523b4413b1fab0ca24d53a22.