WPTT / theme-sniffer

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

Add to requirements php-xml module or check if enabled. #179

Closed erikyo closed 2 years ago

erikyo commented 5 years ago

Describe the bug: if the php-xml module is not active, the plugin goes into a endless loop while checking the template.

To Reproduce the error: disable the php-xml module

OS | any WordPress version | any PHP version | any Browser | any

From the apache log: PHP Fatal error: Uncaught Error: Call to undefined function PHP_CodeSniffer\\Util\\simplexml_load_string() in /my/theme/folder//wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Util/Standards.php:119\nStack trace:\n#0 /my/theme/folder//wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Runner.php(324): PHP_CodeSniffer\\Util\\Standards::getInstalledStandardDetails()\n#1 /my/theme/folder//wp-content/plugins/theme-sniffer/src/callback/class-run-sniffer-callback.php(593): PHP_CodeSniffer\\Runner->init()\n#2 /my/theme/folder//wp-content/plugins/theme-sniffer/src/callback/class-run-sniffer-callback.php(464): Theme_Sniffer\\Callback\\Run_Sniffer_Callback->get_sniff_results(Array)\n#3 /my/theme/folder//wp-includes/class-wp-hook.php(286): Theme_Sniffer\\Callback\\Run_Sniffer_Callback->callback('')\n#4 /my/theme/folder//wp-includes/class-wp-hook.php(31 in /my/theme/folder//wp-content/plugins/theme-sniffer/vendor/squizlabs/php_codesniffer/src/Util/Standards.php on line 119, referer: https://my/theme/folder/wp-admin/admin.php?page=theme-sniffer

dingo-d commented 5 years ago

Thanks for reporting this bug. I'll keep this in mind when writing an update, and try to check if the module is present, or if the function simplexml_load_string() exists on activation, and exit if it doesn't.

erikyo commented 2 years ago

Was closed with #180