1

Topic: Deprecated variables & directives since PHP 7.2

Hello! Thanks for htmlawed.

While running phpcs for testing compatibiltiy with php 7.3 (the recent debian stable - buster provides this version), we found these issues:

[[
-------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------------------------------
371 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
371 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
371 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
372 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
373 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
379 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
381 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
--------------------------------------------------------------------------------------------------------
]]

Hope they can be fixed in a future release of htmlawed.

Thanks!

--jose

2

Re: Deprecated variables & directives since PHP 7.2

[Sorry about the delay in responding]

The line numbers noted in the warnings correspond to the code for the hl_regex function that htmLawed uses to test well-formedness of regular expressions. The code of the function uses if-else; the calls for 'track_errors' and '$php_errormsg' are made only is necessary (i.e., older versions of PHP).

When actually executing htmLawed, I don't see these warnings in my PHP 7.2 setup. I also don't see them in the online PHP code tester at https://3v4l.org/.

I wonder if PHP Code Sniffer (phpcs) is just suggesting that htmLawed's code has 'track_errors' and '$php_errormsg', and not that the code is not compliant with PHP 7.2.