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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

populist’s picture

Status: Active » Postponed (maintainer needs more info)

Is this warning showing up during the installation or when you do a specific action on your site?

sylus’s picture

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)

sylus’s picture

Status: Postponed (maintainer needs more info) » Fixed

Hmm I don't see this anymore in beta 4 so closing this issue :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Project: Panopoly » Panels
Version: 7.x-1.0-beta3 » 7.x-3.2
Status: Closed (fixed) » Active

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:

  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).

timr’s picture

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 ?

timr’s picture

Priority: Normal » Major
merlinofchaos’s picture

Priority: Major » Normal
Status: Active » Fixed
FileSize
865 bytes

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.

webchick’s picture

Status: Fixed » Active

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.

Wim Leers’s picture

Status: Active » Needs review
FileSize
1004 bytes

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 if empty($content->content) is true or false; the problem is that $content->content doesn't exist at all, and when the place holder is being set, you're setting ->content on 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 NULL because 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.

merlinofchaos’s picture

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.

merlinofchaos’s picture

Also, empty($content) should detect a NULL.

Wim Leers’s picture

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->content doesn't make sense, right? :)

DamienMcKenna’s picture

To be syntactically correct the if() statement would need to change to this:

    if (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.:

      if (!is_object($content)) {
        $content = new StdClass();
      }

That said, it's possible that $content should be something else, I haven't tested it further.

DamienMcKenna’s picture

FileSize
989 bytes

A patch that includes both changes suggested in #14 (untested).

jhedstrom’s picture

#15 resolves this warning on php 5.4.6.

achton’s picture

This also works for me on PHP 5.4.4.

bryancasler’s picture

I can confirm that the patch in #15 works

merlinofchaos’s picture

Status: Needs review » Fixed

It would appear that the essence of this patch was already committed here: http://drupalcode.org/project/panels.git/commit/cd02cafcb57c6578f5c017bd...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bryanhidalgo’s picture

Patch #15 works for me too on PHP 5.4.4

a.milkovsky’s picture

#15 works well. But I think we dont need to add !is_object to if condition

   function render_pane_content(&$pane) {
     $content = parent::render_pane_content($pane);
     // Ensure that empty panes have some content.
     if (empty($content) || empty($content->content)) {
+      if (!is_object($content)) {
+        $content = new StdClass();
+      }
       // 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);
NetMajom’s picture

The #15 is worked for me, thx

miromarchi’s picture

Hi there. (I'm a very beginner)
- I had the same warning. In my case I had a node_view panel page with a variant with in place editor (ipe) enabled. When I hit "customize this page" link of ipe on the page and then I hit "save" to save changes in the layout, the warning fired.
- Also, after the warning (repeated 4 times), I had a "warning page not found" and the redirect to the node page after hitting "save" didn't work.
- #15 resolved the first warning. Thank you!
- Still I have the "warning page not found" and I end up with a "blank content" page.
Of course this is not a major.
;-)

EdgarPE’s picture

#15 works for me too.

DamienMcKenna’s picture

Issue summary: View changes

You shouldn't have to apply any patches now, you should just update to Panels 3.4.

  • Commit 92af65e on 7.x-3.x, 7.x-3.x-i18n, 8.x-3.x by merlinofchaos:
    Issue #1632898: Fix strict warning with empty pane content in IPE.