WordPress.org

Support

Support » Themes and Templates » Platform » PHP 5.4 compatibility (

PHP 5.4 compatibility (

  • Platform breaks WP on PHP 5.4, because PHP warnings are generated before HTTP response headers are sent.

    The cause is that class properties are being accessed as objects, without instantiating them as (stdClass) objects first.

    I searched, but wasn’t able to find where to contribute a patch for this, so for now:

    diff --git a/admin/class.options.metapanel.php b/admin/class.options.metapanel.php
    index 535c6ca..3aa6ffb 100644
    --- a/admin/class.options.metapanel.php
    +++ b/admin/class.options.metapanel.php
    @@ -45,7 +45,7 @@ class PageLinesMetaPanel {
     		$key = $option_settings['id'];
    
     		if($location == 'top'){
    -
    +			$top[$key] = new stdClass;
     			$top[$key]->options = $option_array;
     			$top[$key]->icon = $option_settings['icon'];
     			$top[$key]->name = $option_settings['name'];
    @@ -53,6 +53,7 @@ class PageLinesMetaPanel {
     			$this->tabs = array_merge($top, $this->tabs);
    
     		} else {
    +			$this->tabs[$key] = new stdClass;
     			$this->tabs[$key]->options = $option_array;
     			$this->tabs[$key]->icon = $option_settings['icon'];
     			$this->tabs[$key]->name = $option_settings['name'];
    diff --git a/includes/class.layout.php b/includes/class.layout.php
    index 4b0ffba..f35d52d 100644
    --- a/includes/class.layout.php
    +++ b/includes/class.layout.php
    @@ -159,7 +159,12 @@ class PageLinesLayout {
    
     		function set_layout_data(){
    -
    +			foreach (array('hidden', 'main_content', 'sidebar1', 'sidebar2', 'content', 'gutter', 'builder', 'margin', 'dynamic_grid', 'clip', 'column_wrap', 'sidebar_wrap') as $property) {
    +				if (!isset($this->$property)) {
    +					$this->$property = new stdClass;
    +				}
    +			}
    +
     			// Text & IDs
     				$this->hidden->text = '';
     				$this->hidden->id = 'hidden';
    @@ -318,6 +323,7 @@ class PageLinesLayout {
     					/*
     						Set Container width (content + gutter as margin prevents the wider area from being seen)
     					*/
    +					$this->dcol[ $number_of_columns ] = new stdClass;
     					$this->dcol[ $number_of_columns ]->container_width = $this->content->width + $column_gutter - $round_amount;
    
     					$column_space = floor( $this->dcol[ $number_of_columns ]->container_width / $number_of_columns );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP 5.4 compatibility (’ is closed to new replies.
Skip to toolbar