codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
43 stars 24 forks source link

Cast return value of `preg_replace` to `string` #208

Closed fritzmg closed 1 year ago

fritzmg commented 1 year ago

preg_replace can return null when an error occurs - which would then cause the following error down the line:

TypeError:
preg_match_all(): Argument #2 ($subject) must be of type string, null given

  at vendor/codefog/contao-haste/src/StringParser.php:85

@berecont can you test if this fixes your issue?

berecont commented 1 year ago

Sure, the adjustment in line 79 is working.

qzminski commented 1 year ago

Thank you @fritzmg !