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

Preventing infinite loop #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

webmandesign
Copy link

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

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.
@@ -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 ) ) {
Copy link
Contributor

@aristath aristath Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( is_null( $this->css ) ) {
if ( null === $this->css ) {

Copy link
Author

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?

Copy link
Contributor

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 👍

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop
2 participants