Deprecations for preg_match, preg_replace_callback and null argument
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 361
- Avg merge
- 3d 41m
- Merged PRs (30d)
- 2
Description
Seeing this in php8.2
1 PHP Deprecated: preg_replace_callback(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php on line 57
1 PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer.php on line 373
1 PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /vendor/ezyang/htmlpurifier/library/HTMLPurifier/Encoder.php on line 139
Looks like all are cases of the code expecting a string but somewhere allowing null.
php docs do not indicate when this was deprecated, just indicates those parameters should be string|array.
Probably somewhere further up the stack a null check could clear this up.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported calls in library/HTMLPurifier/Lexer/DOMLex.php:57, library/HTMLPurifier/Lexer.php:373, and library/HTMLPurifier/Encoder.php:139, then trace their callers to identify where null reaches the regular-expression functions. Done means PHP 8.2 no longer reports these deprecations while the affected filtering behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100