PHP notices/command line checkings
-
Hello,
It’s great plugin. I see two things. First, there are some PHP notices in debug.log:
[02-Sep-2016 15:24:03 UTC] PHP Notice: Undefined offset: -1 in …/plugins/php-compatibility-checker/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNegativeBitshiftSniff.php on line 50
[02-Sep-2016 15:24:08 UTC] PHP Notice: Undefined offset: -1 in …/plugins/php-compatibility-checker/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNegativeBitshiftSniff.php on line 50Second, function is_command_line(). I use php-cli which execute wp-cron.php. I got few emails with content: ‘started’. I see that close_connection(‘started’) sends it.
You can use function php_sapi_name ( https://php.net/manual/en/function.php-sapi-name.php ).So, my proposal for is_command_line is:
private function is_command_line() {
return defined( ‘WP_CLI’ ) || defined( ‘PHPUNIT_TEST’ ) || php_sapi_name() == ‘cli’;
}I hope that’s helpful.
Sasa
- The topic ‘PHP notices/command line checkings’ is closed to new replies.