-
-
Notifications
You must be signed in to change notification settings - Fork 519
Open
Labels
Component: ExtraStatus: Requirement not metOn hold until WPCS supports a particular version of a dependency (PHP, PHP_CodeSniffer, etc.).On hold until WPCS supports a particular version of a dependency (PHP, PHP_CodeSniffer, etc.).Type: Bug
Milestone
Description
The sniff WordPress.WP.AlternativeFunctions
checks for function calls and constants in the first parameter of file_get_contents()
without differentiating global and non-global function calls and constants. It also fails to differentiate between functions/constants, and class methods/class constants. This leads to false negatives in some cases.
All the examples below don't trigger the sniff, but they should:
file_get_contents(MyNamespace\WP_Upload_Dir()['path'] . 'subdir/file.inc');
file_get_contents(\MyNamespace\WP_Upload_Dir()['path'] . 'subdir/file.inc');
file_get_contents(namespace\WP_Upload_Dir()['path'] . 'subdir/file.inc');
file_get_contents(MyNamespace\ABSPATH . 'wp-admin/css/some-file.css');
file_get_contents(\MyNamespace\ABSPATH . 'wp-admin/css/some-file.css');
file_get_contents(namespace\ABSPATH . 'wp-admin/css/some-file.css');
file_get_contents(MyClass::wp_upload_dir() . 'subdir/file.inc');
file_get_contents($this->wp_upload_dir() . 'subdir/file.inc');
file_get_contents(MyClass::ABSPATH . 'subdir/file.inc');
file_get_contents($this->ABSPATH . 'subdir/file.inc');
jrfnl
Metadata
Metadata
Assignees
Labels
Component: ExtraStatus: Requirement not metOn hold until WPCS supports a particular version of a dependency (PHP, PHP_CodeSniffer, etc.).On hold until WPCS supports a particular version of a dependency (PHP, PHP_CodeSniffer, etc.).Type: Bug