Title: PHP 5.4 compatibility (
Last modified: August 21, 2016

---

# PHP 5.4 compatibility (

 *  [sun](https://wordpress.org/support/users/tha_sun/)
 * (@tha_sun)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-54-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)

 *  [dolby_uk](https://wordpress.org/support/users/dolby_uk/)
 * (@dolby_uk)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/php-54-compatibility/#post-4238391)
 * Thanks, this was the problem for me also
 * Cheers,
 * Dan
 *  [Gabriel Serafini](https://wordpress.org/support/users/gserafini/)
 * (@gserafini)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/php-54-compatibility/#post-4238410)
 * Thank you for the patch! Solved it for me too.
 *  [gregmuzak](https://wordpress.org/support/users/gregmuzak/)
 * (@gregmuzak)
 * [12 years ago](https://wordpress.org/support/topic/php-54-compatibility/#post-4238413)
 * How do I apply this patch? I am having this same issue but can’t figure out what
   to do with the above code.

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

The topic ‘PHP 5.4 compatibility (’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/platform/1.4.4/screenshot.png)
 * Platform
 * [Support Threads](https://wordpress.org/support/theme/platform/)
 * [Active Topics](https://wordpress.org/support/theme/platform/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/platform/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/platform/reviews/)

## Tags

 * [php 5.4](https://wordpress.org/support/topic-tag/php-5-4/)

 * 3 replies
 * 4 participants
 * Last reply from: [gregmuzak](https://wordpress.org/support/users/gregmuzak/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/php-54-compatibility/#post-4238413)
 * Status: not resolved