Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

frameitphoto on "Warning Error - creating default object from empty value"

$
0
0

My web host is forcing me to switch to PHP 5.4. I was on 5.3 and they won't force the switch until next April so plenty of time. Well I switched anyway (although I can go back). An got a problem.

I use the Pagelines Platform theme and two of it's PHP files are throwing errors and lots of them. I detail two below.

The first one throws the error on this line (there are quite a few like this):
$this->hidden->text = '';

The error is: Warning: Creating default object from empty value in /wp-content/themes/platform/includes/class.layout.php on line 167

So I found a way to fix it by adding this if statement before the lines like:

if (!is_object($this->hidden)) {
					$this->hidden = new stdClass;
				}
$this->hidden->text = '';

Now that works and resolved all lines like that. Then I got this type of line with the same warning:

$this->dcol[ $number_of_columns ]->container_width = $this->content->width + $column_gutter - $round_amount;

I tried adding the if statement as above but got an error about an array not being stdClass. This is where my talents runs out and I don't know how to create the if statement to stop it warning about these lines. So, I commented the lines out and tested my site. It still works, as expected on every single page.

I suppose some people would call that a fix, but I am nervous that this will come back and bite me if i do something new or different on the site in the future, so ideally I want to fix it.

I'm on a shared 1&1 so can't get at php.ini to stop warnings showing, and I've tried varying ideas with custom php.ini files in sub folders and mods to .htaccess - all with no luck.

Any help on the sytax around the if statement for the array would be really helpful.

Thanks

David


Viewing all articles
Browse latest Browse all 8245

Trending Articles