inspiredminds/contao-wowjs

Uncaught PHP Exception TypeError: "preg_replace(): Argument #3 ($subject) must be of type array|string, null given"

Closed this issue · 1 comments

I found a small bug which is caused when I use wow.js inside a rocksolid custom element which contains a checkbox.

It's already discussed here:
https://community.contao.org/de/showthread.php?86020-Fehlermeldung-bei-Zusammenspiel-mit-wow-js&p=578319

The error is:

request.CRITICAL: Uncaught PHP Exception TypeError: "preg_replace(): Argument #3 ($subject) must be of type array|string, null given" at /var/www/vhosts/domain.de/vendor/inspiredminds/contao-wowjs/src/EventListener/HookListener.php line 80 {"exception":"[object] (TypeError(code: 0): preg_replace(): Argument #3 ($subject) must be of type array|string, null given at /var/www/vhosts/domain.de/vendor/inspiredminds/contao-wowjs/src/EventListener/HookListener.php:80)"} []

My template which causes this error:

<li<?php if($this->workshop==1) { echo ' class="is-workshop"'; } ?>>

As mentioned in the link above, this can be solved by changing line 77 in HookListener.php to the following:

$attributes = $matches[2] ?? '';

Fixed in 1.1.7 👍