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

\ before global namespace functions causes an escaping function error. #933

Closed
GaryJones opened this issue Apr 16, 2017 · 0 comments · Fixed by #1097
Closed

\ before global namespace functions causes an escaping function error. #933

GaryJones opened this issue Apr 16, 2017 · 0 comments · Fixed by #1097

Comments

@GaryJones
Copy link
Member

Related to #764.

This method is in a namespaced class:

public function do_footer_nav() {
	echo \wp_kses_post(
		\genesis_get_nav_menu(
			[
				'menu_class'     => 'menu genesis-nav-menu menu-footer',
				'theme_location' => 'footer',
			]
		)
	);
}

The presence of the \ before the function calls from the global namespace, means that an error of Expected next thing to be an escaping function, ... not "\" appears.

I've not looked into the change needed, but if the sniff could allow an optional \ before those function checks, that would be great :-)

Using fully-qualified function calls is faster. Details and benchmarks are here. This is from an inspection from the PHP Inspections extension for PhpStorm.

jrfnl added a commit that referenced this issue Aug 7, 2017
This simple change means that namespace separators will be be ignored completely by the check for output escaping which fixes the immediate issue.

For a more thorough fix, the logic of the function would need to be refactored to take namespaced functions into account as well, but that's for another day.
@jrfnl jrfnl added this to the 0.14.0 milestone Aug 7, 2017
GaryJones added a commit that referenced this issue Aug 8, 2017
…e-933-namespaced-functions

XSS.EscapeOutput sniff: Fix issue #933 - namespace separators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants