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
Preventing infinite loop #25
base: master
Are you sure you want to change the base?
Conversation
If the remote URL is generated automatically in the theme, it may be even empty. In such case there is an infinite PHP loop produced, which causes memory error. These changes prevent infinite loop from happening.
wptt-webfont-loader.php
Outdated
@@ -474,7 +489,7 @@ protected function write_stylesheet() { | |||
|
|||
// If we got this far, we need to write the file. | |||
// Get the CSS. | |||
if ( ! $this->css ) { | |||
if ( is_null( $this->css ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( is_null( $this->css ) ) { | |
if ( null === $this->css ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @aristath Can you please explain the reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In WordPress Core we've already replaced all instances of is_null
with strict null === $x
checks.
The reason behind that change was performance (strict checks are faster than an is_null
call), as well as readability and consistency 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarification. I've updated the code.
If the remote URL is generated automatically in the theme, it may even be empty.
In such case there is an infinite PHP loop produced, which causes memory error.
These changes prevent infinite loop from happening.
Fixes #24