Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<v:asset.style/> makes the page crash : "count(): Parameter must be an array" #1827

Open
olinox14 opened this issue Jan 11, 2023 · 1 comment

Comments

@olinox14
Copy link

olinox14 commented Jan 11, 2023

I uses the v:asset.style viewhelper to include my assets to my page, and this was working very well until I updated VHS from 6.1.2 => 6.1.3
Now, this viewhelper makes the page crash, and I got this error :

TYPO3\CMS\Core\Error\Exception

PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/typo3/public/typo3conf/ext/vhs/Classes/Service/AssetService.php line 217

To reproduce, simply add these lines to your page :

<v:asset.style name="fontAwesome"
           path="path/to/css/all.min.css"/>

Typo3 10.4.34
Php 7.4.11

@NamelessCoder
Copy link
Member

I am not able to reproduce this problem.

I am even not sure I understand how this would be possible exclusively by using v:asset.style:

  • There are two cases in the code you reference - either the asset is an instance of AssetInterface, or it is not (in which case, it is almost certainly an array representation of an asset defined or modified in TypoScript, alternatively was created as a raw array through a third party usage of the VHS asset feature).
  • In the case that it is an AssetInterface instance, getVariables() is strictly typed to only be capable of returning an array.

The error in question may be caused by something else - for example, another asset defined in TypoScript which has incorrectly defined the variables as something other than an array, e.g. variables = some string.

Either that, or I'm missing some additional context to help me reproduce this problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants