PHP Errors Fill Log on CLI CRON Requests
-
We usually disable the built-in WP Cron and use server CLI cron jobs instead to trigger the WP Cron tasks.
We run WP_DEBUG in logging mode.
This PHP error (NOTICE level, but still an error) is filling up logs when CLI cron jobs run:
PHP Warning: strpos(): Empty needle in {DOCUMENT_ROOT}/wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 636It’s an easy fix. In line 636, change it from this
if ( false === strpos( $permalink, $WPSC_HTTP_HOST ) ) {to this
if ( empty( $WPSC_HTTP_HOST ) || false === strpos( $permalink, $WPSC_HTTP_HOST ) ) {Just a note: In general, when you use a variable as the needle in a
strpos()directive, test to make sure it’s notempty()first, otherwise PHP will throw errors.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘PHP Errors Fill Log on CLI CRON Requests’ is closed to new replies.