• Resolved johnmagna

    (@johnmagna)


    Hello:

    Had a blank page after upgrading to php 7.1

    Placed a debug option into wp-config.php

    This is what it returned

    [12-Dec-2016 11:41:49 UTC] PHP Fatal error: Cannot use $this as parameter in …/wp-content/themes/raindrops/functions.php on line 9427

    I renamed the raindrops theme in the folder, so the site would be back up.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author nobita

    (@nobita)

    Hi @johnmagna

    I’m not sure, It maybe Cannot use $this Outer object.

    raindrops_wp_headers() function filtered add_filter( 'wp_headers', 'raindrops_wp_headers', 10, 2 );//hooks.php line:175

    Core wp-includes/class-wp.php line:473

    
    /**
    		 * Filters the HTTP headers before they're sent to the browser.
    		 *
    		 * @since 2.8.0
    		 *
    		 * @param array $headers The list of headers to be sent.
    		 * @param WP    $this    Current WordPress environment instance.
    		 */
    		$headers = apply_filters( 'wp_headers', $headers, $this );
    

    I do not have the environment of PHP 7.1 so please try it

    functions.php add below code.

    
    <?php
    /////////// ADD FUNCTION ////////////////////
    	function raindrops_wp_headers( $headers ) {
    
    		global $raindrops_xhtml_media_type;
    
    		/**
    		 * xhtml media type
    		 * value 'application/xhtml+xml' or 'text/html'
    		 */
    		if ( !isset( $raindrops_xhtml_media_type ) ) {
    
    			$raindrops_xhtml_media_type = raindrops_warehouse_clone( 'raindrops_xhtml_media_type' );
    		}
    		if ( !is_admin() && !is_user_logged_in() && 'xhtml' == raindrops_warehouse_clone( 'raindrops_doc_type_settings' ) && $raindrops_xhtml_media_type == 'application/xhtml+xml' ) {
    
    			$headers[ "Content-Type" ] = $raindrops_xhtml_media_type . '; charset=' . get_bloginfo( 'charset' );
    			add_filter( 'option_html_type', 'raindrops_xhtml_media_type', 10 );
    		}
    
    		return $headers;
    	}
    ///////////// END ///////////////////////////
    /**
     *
     *
     * @package Raindrops
     * @since Raindrops 0.1
     */
    if ( !defined( 'ABSPATH' ) ) {
    	exit;
    }
    

    hooks.php change parameter

    
    		/**
    		 * @since 1.261
    		 */
    		add_filter( 'wp_headers', 'raindrops_wp_headers', 10, 2 );
    		/**
    		 * @since 1.270
    		 */
    

    Change below remove 2 parameter

    
    		/**
    		 * @since 1.261
    		 */
    		add_filter( 'wp_headers', 'raindrops_wp_headers', 10 );
    		/**
    		 * @since 1.270
    		 */
    

    Once the problem is resolved, include it in the change in the next version, so please tell us the result

    Above code test result with PHP PHP Version 7.0.10

    DOCUMENT TYPE XHTML + XHTML Media Type header controll : PASS

    
    Content-Type: application/xhtml+xml; charset=UTF-8
    
    
    Content-Type: text/html; charset=UTF-8
    

    Thank you.

    Thread Starter johnmagna

    (@johnmagna)

    Hello @ Nobita

    I made the changes to functions.php and hooks.php line 175.

    It returned the same error on another line number.

    [13-Dec-2016 08:16:46 UTC] PHP Fatal error: Cannot use $this as parameter in …wp-content/themes/raindrops/functions.php on line 9498

    Thanks.

    Theme Author nobita

    (@nobita)

    Thread Starter johnmagna

    (@johnmagna)

    Hello Nobita,

    That worked.

    Thank you for your help.

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

The topic ‘blank page php fatal error’ is closed to new replies.