FloeDesignTechnologies/phpcs-security-audit

IncludeMismatchSniff fails to recognize file extensions when require line ends in a semicolon

Auspicus opened this issue · 4 comments

To reproduce run the sniff over the following:

// Our extension should be picked up as .php
require "required_php_file.php";

/**
 * Instead, the sniff fails to find the extension and we get an error:

 * No file extension has been found in a include/require function.
 * This implies that some PHP code is not scanned by PHPCS.
 */

Sorry but I can't reproduce that actually.

At first your PR made sense.. but then I realized that the regex is OK because it's actually matching over that full string "required_php_file.php" it got from $tokens[$s]['content'].

Can you create a full .php file for me to test on?

I can't still repro that bug.

@Auspicus can you validate on your end the issue is not happening anymore?

Thanks!

Yeah, you can go ahead and close. Not sure how to reproduce either at this point. It's passing on the same code that it failed on before. Maybe another commit had fixed it.

Thanks for the follow up!