wp-cli / doctor-command

Diagnose problems within WordPress by running a series of checks for symptoms
MIT License
145 stars 22 forks source link

Call to undefined function mime_content_type() #123

Closed ibertrix closed 7 years ago

ibertrix commented 7 years ago

All checks work except validate-mime. I use PHP 7.0. I have googled around and apparently the function mime_content_type was deprecated and now it´s rescued in PHP 7.x. Maybe to make doctor work in all PHP versions?

These are the errors:

wp --allow-root doctor check validate-mime Fatal error: Uncaught Error: Call to undefined function runcommand\Doctor\Checks\mime_content_type() in /root/.wp-cli/packages/vendor/wp-cli/doctor-command/inc/checks/class-validate-mime.php:33 Stack trace:

0 /root/.wp-cli/packages/vendor/wp-cli/doctor-command/inc/class-command.php(99): runcommand\Doctor\Checks\Validate_Mime->run()

1 phar:///usr/local/bin/wp/php/class-wp-cli.php(271): runcommand\Doctor\Command->runcommand\Doctor{closure}()

2 phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(1060): WP_CLI::do_hook('after_wp_load')

3 /root/.wp-cli/packages/vendor/wp-cli/doctor-command/inc/class-command.php(277): WP_CLI\Runner->load_wordpress()

4 /root/.wp-cli/packages/vendor/wp-cli/doctor-command/inc/class-command.php(156): runcommand\Doctor\Command->load_wordpress_with_template()

5 [internal function]: runcommand\Doctor\Command->check(Array, Array)

6 phar:///usr/local/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(81): call_user_func(Array, Array, Array)

7 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CL in /root/.wp-cli/packages/vendor/wp-cli/doctor-command/inc/checks/class-validate-mime.php on line 33

danielbachhuber commented 7 years ago

All checks work except validate-mime. I use PHP 7.0. I have googled around and apparently the function mime_content_type was deprecated and now it´s rescued in PHP 7.x. Maybe to make doctor work in all PHP versions?

@ibertrix It looks like mime_content_type() is a part of the Fileinfo PHP extension. Can you make sure this is installed on your system?

ibertrix commented 7 years ago

Thanks, that was it. I have succesfully run the validate-mime. I got a warning saying "Files detected with different MIME type". What does this exactly mean?

danielbachhuber commented 7 years ago

I got a warning saying "Files detected with different MIME type". What does this exactly mean?

As an example, file.png that actually is a JPEG.

We'll be clarifying the error messages in https://github.com/wp-cli/doctor-command/issues/25