WordPress.org

Ready to get started?Download WordPress

Forums

Platform
PHP 5.4 compatibility ( (4 posts)

  1. sun
    Member
    Posted 8 months ago #

    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 );
  2. dolby_uk
    Member
    Posted 7 months ago #

    Thanks, this was the problem for me also

    Cheers,

    Dan

  3. Gabriel Serafini
    Member
    Posted 3 months ago #

    Thank you for the patch! Solved it for me too.

  4. gregmuzak
    Member
    Posted 2 months ago #

    How do I apply this patch? I am having this same issue but can't figure out what to do with the above code.

Reply

You must log in to post.

About this Theme

About this Topic

Tags