com_connect icon indicating copy to clipboard operation
com_connect copied to clipboard

Passing null to parameter #3 ($subject) of type array|string is deprecated

Open jools-r opened this issue 2 years ago • 0 comments

On PHP 8.1 and com_connect 4.9, I get the following error for preg_replace when there's no contained tags, i.e. when using the standard form output:

<txp:com_connect to="[email protected]" subject="Online enquiry" /> ->  8192: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated while parsing form static on page main

The line in question is 361 with this code:

$com_connect_form_id = md5(serialize($atts) . preg_replace('/[\t\s\r\n]/', '', $thing));

and I believe the error is due to the fact that $thing is empty. The following silences the error …

$com_connect_form_id = empty($thing) ? md5(serialize($atts)) : md5(serialize($atts) . preg_replace('/[\t\s\r\n]/', '', $thing));

… but does that have any negative implications for the resulting form id/nonce?

jools-r avatar Jun 12 '22 20:06 jools-r