File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -147,3 +147,27 @@ file_get_contents(
147147 // Not using plugin_dir_path() for reasons.
148148 $ url
149149); // Warning.
150+
151+ /*
152+ * Safeguard correct handling of all types of namespaced function calls
153+ */
154+ \curl_init ();
155+ MyNamespace \curl_init ();
156+ \MyNamespace \curl_init ();
157+ namespace \curl_init (); // The sniff should start flagging this once it can resolve relative namespaces.
158+
159+ /*
160+ * Safeguard correct handling of namespaced parameters passed to file_get_contents().
161+ *
162+ * Note: the sniff should flag the examples using a fully qualified namespaced name and partially
163+ * qualified name, but currently does not. This will be addressed via
164+ * https://github.com/WordPress/WordPress-Coding-Standards/issues/2603.
165+ */
166+ file_get_contents (\wp_upload_dir ()['path ' ] . 'subdir/file.inc ' );
167+ file_get_contents (MyNamespace \wp_upload_dir ()['path ' ] . 'subdir/file.inc ' );
168+ file_get_contents (\MyNamespace \wp_upload_dir ()['path ' ] . 'subdir/file.inc ' );
169+ file_get_contents (namespace \wp_upload_dir ()['path ' ] . 'subdir/file.inc ' );
170+ file_get_contents (\ABSPATH . 'wp-admin/css/some-file.css ' );
171+ file_get_contents (MyNamespace \ABSPATH . 'wp-admin/css/some-file.css ' );
172+ file_get_contents (\MyNamespace \ABSPATH . 'wp-admin/css/some-file.css ' );
173+ file_get_contents (namespace \ABSPATH . 'wp-admin/css/some-file.css ' );
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ public function getWarningList() {
8989 131 => 1 ,
9090 142 => 1 ,
9191 146 => 1 ,
92+ 154 => 1 ,
9293 );
9394 }
9495}
You can’t perform that action at this time.
0 commit comments