FluidTYPO3 / vhs

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

[BUGFIX] Prevent warnings from PHP 8 #1850

Closed DavidR93 closed 1 year ago

DavidR93 commented 1 year ago

Fixes AbstractContentViewHelper under PHP 8: #1846

I also added a change to prevent an exception under PHP 8 if the argument "alternative" of OrViewHelper is null. If the $alternative variable is null, then null is passed as a string type parameter ($haystack) in the strpos() function, which results in an exception.

NamelessCoder commented 1 year ago

Thanks for the patch @DavidR93 - I've replaced the null-coalesce to empty string with an early return, since an alternate value of null needs to be supported (for example, when chaining multiple calls to v:or to check multiple variables and use the first non-null value).

For future patches I would recommend creating a new branch in your forked repository and commit fixes to there, then create the PR based on that branch. This saves you from having to hard reset or re-checkout your development branch in case commits need to be squashed (which is the default merge strategy in VHS).