WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
268 stars 3 forks source link

PHP Fatal Error with every theme #154

Open johnh10 opened 5 years ago

johnh10 commented 5 years ago

Just installed v1.0.0 from WP site. Running WordPress 5.1.1 Options: no theme prefix, only checked WPThemeReview setting. Receive this in error log for every theme checked:

[25-Mar-2019 21:04:04 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to WordPress\Sniff::process() must be an instance of PHP_CodeSniffer_File, instance of PHP_CodeSniffer\Files\DummyFile given, called in /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Files/File.php on line 502 and defined in /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php:838 Stack trace:

0 /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Files/File.php(502): WordPress\Sniff->process(Object(PHP_CodeSniffer\Files\DummyFile), 0)

1 /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Runner.php(592): PHP_CodeSniffer\Files\File->process()

2 /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/src/callback/class- in /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php on line 838

dingo-d commented 5 years ago

What PHP version are you running this on?

johnh10 commented 5 years ago

PHP 7.1.10

balabanov commented 5 years ago

Can confirm the same problem, log output is

[06-Apr-2019 09:48:18] WARNING: [pool www] child 20148 said into stderr: "NOTICE: PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to WordPress\Sniff::process() must be an instance of PHP_CodeSniffer_File, instance of PHP_CodeSniffer\Files\DummyFile given, called in /usr/share/nginx/v2/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Files/File.php on line 502 and defined in /usr/share/nginx/v2/wp-content/plugins/theme-sniffer/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php:838" [06-Apr-2019 09:48:18] WARNING: [pool www] child 20148 said into stderr: "Stack trace:" [06-Apr-2019 09:48:18] WARNING: [pool www] child 20148 said into stderr: "#0 /usr/share/nginx/v2/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Files/File.php(502): WordPress\Sniff->process(Object(PHP_CodeSniffer\Files\DummyFile), 0)" [06-Apr-2019 09:48:18] WARNING: [pool www] child 20148 said into stderr: "#1 /usr/share/nginx/v2/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Runner.php(592): PHP_CodeSniffer\Files\File->process()" [06-Apr-2019 09:48:18] WARNING: [pool www] child 20148 said into stderr: "#2 /usr/share/nginx/v2/wp-content/plugins/theme-sniffer/src/callback/class-run-sniffer-callback.php(595): PHP_CodeSniffer\Runner->processFile(Object(PHP_CodeSniffer\Files\DummyFile))" [06-Apr-2019 09:48:18] WARNING: [pool www] child 20148 said into stderr: "#3 /usr/share/nginx/v2/wp-content/plugi..."

Environment

dingo-d commented 5 years ago

Hi @balabanov @johnh10 Can you reproduce this with the latest version?

balabanov commented 5 years ago

Just confirmed in 1.1.1 version, same behavior

johnh10 commented 5 years ago

Yes a fatal error with v1.1.1, though stack trace is slightly different.

[21-Aug-2019 17:58:54 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to PHPCompatibility\Sniffs\Miscellaneous\RemovedAlternativePHPTagsSniff::process() must be an instance of PHP_CodeSniffer_File, instance of PHP_CodeSniffer\Files\DummyFile given, called in /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Files/File.php on line 489 and defined in /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php:70 Stack trace:

0 /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Files/File.php(489): PHPCompatibility\Sniffs\Miscellaneous\RemovedAlternativePHPTagsSniff->process(Object(PHP_CodeSniffer\Files\DummyFile), 0)

1 /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/ in /home/domains/superblogme.com/htdocs/development/testsite/wp-content/plugins/theme-sniffer/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php on line 70

dingo-d commented 5 years ago

This happens when you download the plugin from the .org as well? https://wordpress.org/plugins/theme-sniffer/

I'll try to see if this is due to a theme or something else, it's odd that this is happening.