Posted by sylus on June 13, 2012 at 6:24pm
17 followers
| Project: | Panels |
| Version: | 7.x-3.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I am recieving an error using php 5.3.9:
Strict warning: Creating default object from empty value in panels_renderer_ipe->render_pane_content() (line 145 of /Users/sylus1984/Desktop/NewKit/profiles/webexp/modules/contrib/panels/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php).I think this is a similar issue where merlinofchaos mentions this notice in comment #33:
http://drupal.org/node/1186702
Comments
#1
Is this warning showing up during the installation or when you do a specific action on your site?
#2
Just when I appear on the demo page (/demo) but no where else ^_^
Steps to reproduce I believe:
1) Use Acquia Desktop + Switch to php 5.3.9 in interface
2) Install Panopoly on top of it
3) Login and go to the demo page (home or /demo)
#3
Hmm I don't see this anymore in beta 4 so closing this issue :)
#4
Automatically closed -- issue fixed for 2 weeks with no activity.
#5
Seeing this on Panels 7.x-3.2 on the same line of the same file. Looks like if the pane was empty, the parent returns NULL and the object is not present, therefore the error:
<?php
function render_pane_content(&$pane) {
$content = parent::render_pane_content($pane);
// Ensure that empty panes have some content.
if (empty($content->content)) {
// Get the administrative title.
$content_type = ctools_get_content_type($pane->type);
$title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
$content->content = t('Placeholder for empty "@title"', array('@title' => $title));
?>
Line 145 is the last one. parent:.render_page_content() can possibly return NULL (or FALSE).
#6
Can someone look at this and fix it please?
I'm getting the same error and It's really annoying.
Will this be fixed in 7.x-3.x-dev ?
#7
#8
A strict warning is never major; you can always make sure that errors don't display to your users in your error handling settings.
The bug was also re-opened only 3 days before #6 was posted, so a little patience would seem to be warranted.
That said, the fix itself is quite easy.
The attached patch is committed and pushed.
#9
Hm. For whatever reason, I'm still seeing this on the front page in the latest Spark build, which includes Panels 7.x-3.3, which therefore includes this fix. Digging.
#10
In my testing, this is only happening for the "User login" block.
From what I can tell, your patch in #8 is unfortunately a no-op, Merlin. The problem is that
$content === NULL, so it doesn't matter ifempty($content->content)is true or false; the problem is that$content->contentdoesn't exist at all, and when the place holder is being set, you're setting->contenton a non-object (i.e.:NULL).Attached is a patch that detects if
$content === NULL, and if so, it bails; it doesn't try to create a placeholder because it won't be shown anyway. That solves the symptom.The root cause lies deeper though, the "User login" block is most likely
NULLbecause there shouldn't be a user login block when the user is already logged in.Either Panels is designed to pass around these NULLs when they should render nothing, or there's a bug that's causing this block to be rendered while it shouldn't be.
#11
Panels does sometimes have to 'render' an empty block. For example, in the IPE, it needs a placeholder in order to administer the empty block, even though nothing actually appears for that block.
#12
Also, empty($content) should detect a NULL.
#13
NULL is considered empty. But the patch *doesn't* want it to be empty. But NULL isn't an object, so you can't set
->content.NULL->contentdoesn't make sense, right? :)#14
To be syntactically correct the if() statement would need to change to this:
<?phpif (empty($content) || !is_object($content) || empty($content->content)) {
?>
But then the code would also have to verify that $content was an object before it gets to line 145 where it tries to assign data to its attributes, e.g.:
<?phpif (!is_object($content)) {
$content = new StdClass();
}
?>
That said, it's possible that $content should be something else, I haven't tested it further.
#15
A patch that includes both changes suggested in #14 (untested).
#16
#15 resolves this warning on php 5.4.6.
#17
This also works for me on PHP 5.4.4.
#18
I can confirm that the patch in #15 works
#19
It would appear that the essence of this patch was already committed here: http://drupalcode.org/project/panels.git/commit/cd02cafcb57c6578f5c017bd...
#20
Automatically closed -- issue fixed for 2 weeks with no activity.
#21
Patch #15 works for me too on PHP 5.4.4