Fix issue with accessing array offset on boolean value in get_custom_logo_url function#69
Open
umairayub79 wants to merge 1 commit intoimranhsayed:masterfrom
Open
Fix issue with accessing array offset on boolean value in get_custom_logo_url function#69umairayub79 wants to merge 1 commit intoimranhsayed:masterfrom
umairayub79 wants to merge 1 commit intoimranhsayed:masterfrom
Conversation
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.
Issue:
I encountered an issue with the
get_custom_logo_urlfunction where a warning was triggered due to attempting to access an array offset on a boolean value. This warning occurred on line 139 of theclass-header-footer-api.phpfile in theheadless-cms-masterplugin. The warning arose because the function did not handle scenarios where the theme either did not support a custom logo or when no logo was set.<b>Warning</b>: Trying to access array offset on value of type bool in <b>/home/baloch/Local Sites/headless/app/public/wp-content/plugins/headless-cms-master/inc/classes/api/class-header-footer-api.php</b> on line <b>139</b><br />Additionally, there's an existing issue (#33) titled "Cannot find custom logo" that seems related to the same warning message.
Solution:
To address this issue comprehensively, I made the following improvements:
has_custom_logo()function to check if the current theme supports a custom logo.These changes ensure that the
get_custom_logo_urlfunction gracefully handles variations in theme configurations, preventing the warning from being triggered and providing a more robust solution overall.