Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.10] [PHP 8.1] Fix HtmlDocument preg_split(): Passing null to $limit of type int #36775

Merged
merged 1 commit into from
Jan 23, 2022

Conversation

beat
Copy link
Contributor

@beat beat commented Jan 21, 2022

Pull Request for Issue # none, found and fixed directly here.

Summary of Changes

Fixes PHP 8.1 incompatibility Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in libraries/src/Document/HtmlDocument.php on line 595

Actually, null would converts to 0, but it's the same as the function's default value of -1 that was expected there.

See https://www.php.net/manual/en/function.preg-split.php :

limit
If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1 or 0 means "no limit".

Testing Instructions

Open administrator backend in debug mode (with all incl. deprecation warnings turned on), and see this warning, then apply patch and see it disappear.

Actual result BEFORE applying this Pull Request

Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in libraries/src/Document/HtmlDocument.php on line 595

Expected result AFTER applying this Pull Request

warning disappeared.

Documentation Changes Required

none.

…t of type int

Fixes `Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in libraries/src/Document/HtmlDocument.php on line 595`
@alikon alikon added the PHP 8.x PHP 8.x deprecated issues label Jan 21, 2022
@richard67
Copy link
Member

I have tested this item ✅ successfully on 81ca5b3

Code review with respect to PHP documentation.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36775.

@Fedik
Copy link
Member

Fedik commented Jan 22, 2022

I have tested this item ✅ successfully on 81ca5b3


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36775.

@Fedik Fedik removed PR-3.10-dev PHP 8.x PHP 8.x deprecated issues labels Jan 22, 2022
@Fedik
Copy link
Member

Fedik commented Jan 22, 2022

R2C


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36775.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 22, 2022
@Fedik Fedik added PR-3.10-dev PHP 8.x PHP 8.x deprecated issues labels Jan 22, 2022
@zero-24 zero-24 added this to the Joomla 3.10.6 milestone Jan 23, 2022
@zero-24
Copy link
Contributor

zero-24 commented Jan 23, 2022

Thanks merging.

@zero-24 zero-24 merged commit 7021322 into joomla:3.10-dev Jan 23, 2022
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP 8.x PHP 8.x deprecated issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants