Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Prefix error for $GLOBALS['content_width'] #103

Open
surimohnot opened this issue Feb 26, 2019 · 7 comments
Open

Prefix error for $GLOBALS['content_width'] #103

surimohnot opened this issue Feb 26, 2019 · 7 comments
Assignees
Labels
Status: Awaiting Feedback The issue or fix needs more feedback from people with more experience about it. Status: Future Release This issue will be fixed in the future release of the plugin, or an enhancement will be added in the Status: Help Wanted A help is needed regarding an issue or an opened PR. Status: Possible Bug This issue is a possible bug, but might not be (could be a misunderstanding or a false positive). Status: Upstream Issue This is an upstream issue, either in the WPCS, WPThemeReview or PHPCS. Type: Enhancement This is an enhancement of the existing features or a new feature to the plugin.

Comments

@surimohnot
Copy link

Plugin gives error for not prefixing $GLOBALS['content_width'] (mostly in any theme's functions.php file). It should not be prefixed.

This error is only visible if you have added theme prefix/s.

@dingo-d
Copy link
Member

dingo-d commented Feb 26, 2019

This is triggered because of the $GLOBALS variable. And could be related to: WordPress/WordPress-Coding-Standards#1437

Can you open an issue on the https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/ repo about this issue with the code example?

Thanks

@dingo-d dingo-d self-assigned this Feb 26, 2019
@dingo-d dingo-d added the Status: Upstream Issue This is an upstream issue, either in the WPCS, WPThemeReview or PHPCS. label Feb 26, 2019
@timelsass
Copy link
Member

As a note on this topic - wooCommerce uses a lot of globals in their templates, and themes that copy over templates with their own logic do get a lot of errors reported even though there might not be a way to work around that for the author.

@dingo-d
Copy link
Member

dingo-d commented Mar 2, 2019

One option would be to ignore woocommerce folder from the theme, but I wouldn't do that (those files shouldn't have errors or things like iframes for instance).

The globals thing is known in the WPCS and I think there are tons of issues opened about it 😕

@joyously
Copy link

joyously commented Mar 2, 2019

$content_width should be white listed.

@timelsass
Copy link
Member

$content_width should get a setter method 😄

@dingo-d
Copy link
Member

dingo-d commented Mar 4, 2019

Can you open an issue, or comment on a new one in the WPCS repo? 🙂

@justintadlock
Copy link

Related Trac ticket: https://core.trac.wordpress.org/ticket/21256

@dingo-d dingo-d added Type: Enhancement This is an enhancement of the existing features or a new feature to the plugin. Status: Help Wanted A help is needed regarding an issue or an opened PR. Status: Future Release This issue will be fixed in the future release of the plugin, or an enhancement will be added in the Status: Possible Bug This issue is a possible bug, but might not be (could be a misunderstanding or a false positive). Status: Awaiting Feedback The issue or fix needs more feedback from people with more experience about it. labels Mar 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: Awaiting Feedback The issue or fix needs more feedback from people with more experience about it. Status: Future Release This issue will be fixed in the future release of the plugin, or an enhancement will be added in the Status: Help Wanted A help is needed regarding an issue or an opened PR. Status: Possible Bug This issue is a possible bug, but might not be (could be a misunderstanding or a false positive). Status: Upstream Issue This is an upstream issue, either in the WPCS, WPThemeReview or PHPCS. Type: Enhancement This is an enhancement of the existing features or a new feature to the plugin.
Projects
None yet
Development

No branches or pull requests

5 participants