Deprecation Warning: HtmLawed Editor 2.0.10
Deprecation Warning: HtmLawed Editor 2.0.10
I am in the process of upgrading to PHP 8.1.12 and I am receiving deprecation warnings. I have updated to Editor 2.0.10 and applied the latest fix for Format.php dated 10th October which resolved many of the errors, however I am still receiving the following for a few pages:
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in .... Editor-PHP-2.0.10\lib\HtmLawed\Htmlawed.php on line 95
The table does not contain any null values, so I am confused why the error should suggest that it is caused by passing a null parameter?
I have narrowed the issue to page that utilise Upload and the error can be corrected by setting the field with
->xss( false )
as per another forum answer in May 22. https://datatables.net/forums/discussion/67011/is-datatable-editor-php-8-0-compatible#latest
From a security perspective I would prefer to leave it enabled. Does anyone know of a fix to resolve the issue or offer advice on how I can narrow down the cause of the issue?
This question has an accepted answers - jump to answer
Answers
Hi,
Thanks for flagging this up. Could you try the latest file from here please? Just replace the contents of your local file with the code from there. That updates HTMLawed to the latest available version and it appears to be running okay on a quick check. Our nightly build will give it a proper test.
Allan
Thank you for the quick reply. I have updated and I receive the same error, however it is now line 189
Thanks for letting me know. How odd that I'm not seeing it. Can you show me your Editor PHP initialisation please? I'll try to recreate it here with that. Is it on upload, or on submit after uploading a file?
Allan
Please see my editor PHP code below. The error is displayed on initial page load and the only way to render the page is to add xss(false).
Thank you - I'm a little surprised that it is happening on load since the XSS stuff doesn't kick in at that point - which suggests it is something to do with the initialisation in HTMLawed. I'll get back to you once I've set this up locally.
Allan
Got it now - thanks! I've committed the fix here. If you grab the latest copy of
Field.php
and replace your local file with the contents of the updated file it will spring back into action!Regards,
Allan
Thank you, that fixed it.
Awesome - thanks for the confirmation
Allan