Fixed Template modification does not report anything if preg_match_all fails

TickTackk

Well-known member
Affected version
2.0.7
In file src\XF\Repository\TemplateModification.php at line 92
PHP:
                        $status[$id] = preg_match_all($modification['find'], $template, $null);
Will set the status for template modification to false if \preg_match_all fails, as it should, but if it fails with the condition \preg_last_error() !== \PREG_NO_ERROR then no status is shown in the template modification log AND will cause the page to render nothing.

Fix would be to add this after src\XF\Repository\TemplateModification.php:92
PHP:
                        if ($status[$id] === false && \preg_last_error() !== \PREG_NO_ERROR) 
                        {
                            $status[$id] = 'error_invalid_regex';
                            break;
                        }

Result would be something like this:
1582638352851.png
 
Last edited by a moderator:
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.8).

Change log:
Check preg_last_error() when processing template modifications
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom