codefog / contao-haste

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

StringParser type error if error while replacement #189

Closed rabauss closed 1 year ago

rabauss commented 1 year ago

If an error occurs in the following replacement in the stringParser it will return null https://github.com/codefog/contao-haste/blob/8f0d8f229dbffc2190a11e42ecbaeb62d7928297/src/StringParser.php#L78-L79

Unfortunately the null will throw a type error in the following replacements: https://github.com/codefog/contao-haste/blob/8f0d8f229dbffc2190a11e42ecbaeb62d7928297/src/StringParser.php#L85

Do we need a further check for is_string after trying to remove invisible control characters and unused code points or should we handle the error there?

rabauss commented 1 year ago

Today, I realized that the error occurs if the value is or includes a binary uuid which we add via hook prepareFormData. I solve it now by replacing this values in the hook to strings!

rabauss commented 1 year ago

I guess this is fixed by @fritzmg with https://github.com/codefog/contao-haste/pull/208