• Resolved ngrudev

    (@ngrudev)


    Hi,

    After I disabled wordpress cron jobs and transfer them into the CPanel with 1 hour interval, every time the cpanel cron job ran, this error is written in debug.log

    [03-Nov-2016 04:00:03 UTC] PHP Warning: strpos(): Offset not contained in string in /home/lugabglj/public_html/bg_wp/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 16
    [03-Nov-2016 05:00:04 UTC] PHP Warning: strpos(): Offset not contained in string in /home/lugabglj/public_html/bg_wp/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 16
    [03-Nov-2016 06:00:03 UTC] PHP Warning: strpos(): Offset not contained in string in /home/lugabglj/public_html/bg_wp/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 16
    [03-Nov-2016 07:00:03 UTC] PHP Warning: strpos(): Offset not contained in string in /home/lugabglj/public_html/bg_wp/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 16
    [03-Nov-2016 08:00:03 UTC] PHP Warning: strpos(): Offset not contained in string in /home/lugabglj/public_html/bg_wp/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 16
    [03-Nov-2016 09:00:04 UTC] PHP Warning: strpos(): Offset not contained in string in /home/lugabglj/public_html/bg_wp/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 16

    Is this a bug and how to fix it? Thank you.

    Niki

    • This topic was modified 9 years, 7 months ago by ngrudev.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You could reset all that and use CometCache. I finally gave up trying to get SC running on one server where I have a tube site.

    Thread Starter ngrudev

    (@ngrudev)

    I like WP SC and don’t want to change it only for one stupid notice in debug.log.

    The code in wp-cache-base.php is as follows:

    <?php
    $known_headers = array("Last-Modified", "Expires", "Content-Type", "Content-type", "X-Pingback", "ETag", "Cache-Control", "Pragma");
    
    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
    
    // We want to be able to identify each blog in a WordPress MU install
    $blogcacheid = '';
    if ( defined( 'VHOST' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) {
    	$blogcacheid = 'blog'; // main blog
    	if( defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == true ) {
    		$blogcacheid = $WPSC_HTTP_HOST;
    	} else {
    		if ( isset( $base ) == false )
    			$base = '';
    		$request_uri = str_replace( '..', '', preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER['REQUEST_URI'] ) );
    		if( strpos( $request_uri, '/', 1 ) ) {
    			if( $base == '/' ) {
    				$blogcacheid = substr( $request_uri, 1, strpos( $request_uri, '/', 1 ) - 1 );
    			} else {
    				$blogcacheid = str_replace( $base, '', $request_uri );
    				if ( $blogcacheid != '' )
    					$blogcacheid = substr( $blogcacheid, 0, strpos( $blogcacheid, '/', 1 ) );
    			}
    			if ( '/' == substr($blogcacheid, -1))
    				$blogcacheid = substr($blogcacheid, 0, -1);
    		}
    		$blogcacheid = str_replace( '/', '', $blogcacheid );
    	}
    }
    
    ?>

    The “bad” line is:

    		if( strpos( $request_uri, '/', 1 ) ) {
    

    Probably this line is not written perfectly corect.

    Thread Starter ngrudev

    (@ngrudev)

    I resolved it. It wasn’t problem with Wp Super Cache. Because I’ve stopped WP cron jobs and transfer them in CPANEL cron job, I am starting the cron through manual execution file. For some reasons because of this approach $_SERVER[“REQUEST_URI”] returns blank, which is the problem.

    I resolved it with manually set of $_SERVER[“REQUEST_URI”] to “/”

    $_SERVER[“REQUEST_URI”] = array_key_exists( ‘REQUEST_URI’, $_SERVER) ? $_SERVER[‘REQUEST_URI’] : “/”;

    Hope this will help those, who are disabled WP cron jobs, and make it in CPANEL.

    $_SERVER[“REQUEST_URI”] = array_key_exists( ‘REQUEST_URI’, $_SERVER) ? $_SERVER[‘REQUEST_URI’] : “/”;

    Did You Add this to the bottom of the wp-cache-base.php ?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP Warning: wp-cache-base.php on line 16’ is closed to new replies.