Fix PHP 8.1 notice "PHP Deprecated: strpos(): Passing null to parameter #1" when saving an article#39299
Merged
laoneo merged 1 commit intojoomla:4.2-devfrom Nov 28, 2022
Conversation
This was referenced Nov 24, 2022
laoneo
approved these changes
Nov 24, 2022
Contributor
|
I have tested this item ✅ successfully on 4f91d90 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39299. |
Contributor
|
I have tested this item ✅ successfully on 4f91d90 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39299. |
Member
Author
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39299. |
Member
|
Thank you! |
obuisard
added a commit
to Digital-Peak/joomla-cms
that referenced
this pull request
Dec 12, 2022
Introduced changes made in PR joomla#39299
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #39298 .
Summary of Changes
Add
is_stringcheck before callingstrposfor the intro text which might be null when no Read More button.Testing Instructions
On PHP 8.1 with error reporting set to maximum in Global Configuration and PHP configured to log errors into a log file, edit an article in backend which has no Read More button and so has no intro text. Save the article. Then check the PHP error log file.
Actual result BEFORE applying this Pull Request
PHP notice
PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /path-to-your-joomla-site/plugins/content/fields/fields.php on line 66.Expected result AFTER applying this Pull Request
No such notice.
Link to documentations
Please select:
No documentation changes for docs.joomla.org needed
No documentation changes for manual.joomla.org needed