Hi,
i use ctools on vary pages..but one got a problem with the new release 7.x1.2. The frontpage is a panel and after updating to 7.x1.2 i become this list of errors on the frontpage. i try the dev version but from 19. august but the same...so i switch back to ctools 7.x1.1 an all error msg are gone and the site is still working.

Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 152 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 153 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 162 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 166 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 289 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 293 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 152 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 153 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 162 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 166 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 289 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 293 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 152 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 153 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 162 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 166 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 289 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 293 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 152 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 153 von ./modules/ctools/plugins/content_types/block/block.inc).
Notice: Trying to get property of non-object in ctools_block_content_type_render() (Zeile 156 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 156 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 166 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 289 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 293 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 152 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 153 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 162 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (Zeile 166 von ./modules/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 289 von ./modules/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (Zeile 293 von ./modules/ctools/includes/content.inc).

Files: 
CommentFileSizeAuthor
#32 ctools-fix-warning-message-1739718-32.patch944 bytesIshaDakota
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#30 ctools-fix-warning-message-1739718-30.patch1.26 KBIshaDakota
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#27 ctools-fix-warning-message-1739718-27.patch936 bytesrickmanelius
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#27 interdiff.txt377 bytesrickmanelius
#26 ctools-fix-warning-message-1739718-26.patch940 bytesIshaDakota
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#1 1739718-fix-block-warning.patch629 bytesmerlinofchaos
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new629 bytes
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

This patch should fix that.

I'll commit this as soon as I get confirmation from someone experiencing this problem that it fixes it.

Hello,

yes it works for me, I applied it to the latest dev.

thanks for the patch!

Hi,
I installed the 1.2 ver.
I applied the patch ( I dont know how but: )
I switched the lines from

$block = (object) $block;
   }

to
   }
$block = (object) $block;

but I still get one worning:
Notice: Trying to get property of non-object in-ctools_block_content_type_render() (line 156 from-/home5/myfolder/public_html/mysite/sites/all/modules/ctools/plugins/content_types/block/block.inc).

whats wrong?!
Thanks a lot

I tried also with the 1.2 version and it works.

To apply the patch go to the ctools folder in your terminal window and type:
curl http://drupal.org/files/1739718-fix-block-warning.patch | git apply

patch applied. I still get the same single remaining error as #4.

hi,

after applying the patch i get the blogs now on the frontpage ..but one single error appears

Notice: Trying to get property of non-object in ctools_block_content_type_render() (Zeile 156 von ./sites/all/modules/ctools/plugins/content_types/block/block.inc).

zeile 155,156,157

  if ($module == 'block') {
    $block->title = $info->title;
  }

I applied the patch. Works like a charm!

I have 4 drupal websites.
I tried to update to ver 1.2 in all the 4 websites.
in 2 websites ver 1.2 is fine (even without the patch)
In the other (2) I have the same problem (#4) (even after apply the patch)
still in 1.1 ver.

Patch seems to remove the warnings for me. Thank you

Patch applied (per note here: http://drupal.org/node/1738540). Went from:

Warning: Attempt to assign property of non-object in ctools_content_render() (line 301 of ./sites/all/modules/ctools/includes/content.inc).

to

Notice: Trying to get property of non-object in ctools_block_content_type_render() (line 156 of ./sites/all/modules/ctools/plugins/content_types/block/block.inc).

#1 took care of the Warning for me against D7.15, thanks Merlin.

Status:Needs review» Needs work

I get the warning only when I try to limit the block visibility to not appear on the frontpage (with default block UI). This block is also inside a panel on the frontpage. Hope this help.

Patch worked for me.

patch still leaves me with
"Notice: Trying to get property of non-object in ctools_block_content_type_render() (line 156 of /var/www/drupal7Sites/sites/all/modules/ctools/plugins/content_types/block/block.inc)." - wondering if it's worth rolling back, since I accidentally did this on a production site...

On a production site you can always go into your administration under error reporting, I think, and check the setting that tells it NOT to report error messages to the user. In general on a production site this is a good idea (and on a dev site you do want error reporting).

on a front page with a panel - fixed the issue for me.

i have a front page with a panel and this issue is not fixed!

Patch didnt solve it for me either, not reverting back to previous ctools either, but then i remebered i also updated panels. So i reverted back that update too and now site is back to normal

I've patched it like this:

function ctools_block_content_type_render($subtype, $conf) {
  list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf);
  ...
  if (empty($block)) {
    return;
  }
  if (is_array($block)) {                 // patch
    $block = (object)$block;              // patch
  }
  ...
}

Seems simple enough. No more warnings for me. I had to do this for menu_block blocks...

Earl,
Maybe in the function: function ctools_block_content_type_render ( ./sites/all/modules/ctools/plugins/content_types/block/block.inc)
its necessary to Ensure before, with isset function, the $info->title Variable.

before:

  if ($module == 'block') {
  $block->title = $info->title;
  }
  else if (isset($block->subject)) {
    $block->title = $block->subject;
  }
  else {
    $block->title = NULL;
  }

after:
  if ($module == 'block') {
    if (isset($info->title)){
      $block->title = $info->title;
      }}
  else if (isset($block->subject)) {
    $block->title = $block->subject;
  }
  else {
    $block->title = NULL;
  }

it resolved the issue.
I dont know yet how to create a patch, ( I was happy if I had patch commit in ctools module ) ;-)
the lines 516-519 on the file helped me
  // $block->title is not set for the blocks returned by block_block() (the
  // Block module adds the title in block_list() instead), so we look it up
  // manually, unless the title is overridden and does not use the %title
  // placeholder.

Thanks.

Thanks! #1 and #21 helped me.

#1 and #21 work for me too. I'd do them slightly differently, but it makes very little difference:

For #1, move $block = (object) $block; out of if (!empty($info)) { and as #20 suggests wrap it in if( is_array($block))

For #21, not sure why the new if is nested as that could leave $block->title needlessly unset, seems to make more sense to simply replace   if ($module == 'block'){ with if ($module == 'block' && isset($info->title)) {. So the new code would be:

  if ($module == 'block' && isset($info->title)) {
    $block->title = $info->title;
  }
  else if (isset($block->subject)) {
    $block->title = $block->subject;
  }
  else {
    $block->title = NULL;
  }

#1 and #23 worked for me

I'm no expert but I wonder with you,
1.
what about function ctools_user_login_pane_render line 484
maybe also there need to add in line 519

if ($module == 'block') {
    $block->title = $info->title;
  }

the isset Condition (isset($info->title))?
2.
is $module == 'block' Condition necessary?
maybe just
if (isset($info->title)) {
    $block->title = $info->title;
  }

Is Enough?
The goal is to commit & release correctly code, :-)
Thanks.
#23 - thanks (That's how the code looks like when tests...)

Status:Needs work» Needs review
StatusFileSize
new940 bytes
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Patch that includes original in #1 plus #23. Applied and tested - working here.

StatusFileSize
new377 bytes
new936 bytes
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Just a quick style note for the patch in #26... you have a whitespace issue right above "if (empty($block)) {" on line 13 of your patch. A quick re-roll and an interdiff.

I believe we'll need a !empty($info) to prevent a strict warning as well.

whats about function ctools_user_login_pane_render line 484?

StatusFileSize
new1.26 KB
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

employed as such?:

if (!empty($info)) {
    if ($module == 'block' && isset($info->title)) {
      $block->title = $info->title;
    }
    else if (isset($block->subject)) {
      $block->title = $block->subject;
    }
    else {
      $block->title = NULL;
    }
  }

@ntigh52, you may be right about ctools_user_login_pane_render(), but I can't create a problem there. Do you have one?

No, the $block->title = $block->subject will need to potentially happen even if $info is empty. I would put it as this:

<?php
 
if ($module == 'block' && !empty($info) && isset($info->title))
?>

StatusFileSize
new944 bytes
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

right, of course. Thanks.

This should do then.

Patch at #32 fixed this for me. Anyone else?

cleared the problem for me! +1

Status:Needs review» Reviewed & tested by the community

#32 works for me as well. Seeing as it fixed both trouble areas and also uses the exact fix as merlinofchaos suggested in #31 and we have 3 successful reviews, marking as RBTC.

Patch at #32 fixed this for me too.
This issue problem seems fixed!
Thanks to all.

@eule, whats about you?

Patch at #32 fixed my problem, and re-enabled the display of a view block that I lost with this update. Thanks.

@ntigh52 i switch back to 1.1 but i can test it ..wait a half hour

+1 in my environment this patch from #32 fix the error...so thanks all for your work

I assume an update will be posted soon.

#32 working for me also, thanks!
greetings, Martijn

Status:Reviewed & tested by the community» Fixed

Committed and pushed.

#32 worked for me as well!

Thanks! #32 working patch, solved the problem

#20 worked best for me

Hi there,

Can you help on 7.14 or 7.15 version.

thanx

@nabilb,
Its work fine on 7.14 or 7.15 Drupal core version.
the version in this issue is of the Chaos tool suite (ctools) module.

@BenVercammen Thanks, It work for me.

#32 working for me also, thanks!

My core is 7.15
I switched the lines from

$block = (object) $block;
   }

to

}
$block = (object) $block;

and it's work for me.

#32 should be commited. It worked for me brilliantly.

#32 worked for me (drupal core version 7.15)

Folks this is commited. No need to report that it is working. Use the latest dev.

Status:Fixed» Needs review

#1: 1739718-fix-block-warning.patch queued for re-testing.

Status:Needs review» Reviewed & tested by the community

We're using #32 and really see that it should be in the next release.

Why are we retesting and marking RTBC already committed patches?

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Needs review

#1: 1739718-fix-block-warning.patch queued for re-testing.

Status:Needs review» Fixed

Really...

Status:Fixed» Closed (fixed)

@inventa
Your first action on drupal.org was unnecessarily retriggering the test process for an already committed patch. Congrats. Please learn about how to use and behave in the issue queue by reading: http://drupal.org/node/317

I am closing this one with the hope that people won't leave this thing rest already.

@inventa, welcome to the Drupal community! Most of us are pretty friendly :-)

Thanks for the patch! Fixed this just in time :-)

#21 worked fine, Thanks a bunch.

#32 worked great for me.

#32 worked for me should goto module update

STOP POSTING THAT THIS WORKS! THIS IS ALREADY IN DEV. SEE #43 and #58

Status:Closed (fixed)» Fixed

As dddave repeats, this is broken in 1.2 (current stable release today) but fixed in 1.x-dev -- I think it will be better that a maintainer commit this into a stable release so that more developers (like me) are not heavily searching for an answer.

I understand ctools is a very complicated and highly dependent utility so it may it be tough to maintain a regulated release schedule. I'm curious though, what issues are stopping us from a stable release? I'm guessing a lot of issues are implemented in -dev and need testing. It's been over 2 months since the last stable release.

* edit: didn't mean to change status, don't think it will hurt anything though.

It's okay to run a -devif you need to. There will be a release when I have the time and energy to go make one. Please stop putting energy into something already fixed.

Okay, from a completely ignorant non-programmer...

How do I implement the patch in #32? Where or where in my little ol' Mac do I plug that code to make this stupid warning disappear?

Status:Fixed» Closed (won't fix)

As stated multiple times in this issue you can use the latest dev where this code is already committed. If you don't want to do this you can patch manually: http://drupal.org/patch/apply

Status:Closed (won't fix)» Fixed

@curtispenner, I can understand your feeling...
Lets try do it in words:
Before all, backup the file that you need to change code inside.
inside the ctools folder: there is a file in the destination ctools/plugins/content_types/block/block.inc
inside this file, find the function ( line 135 )

function ctools_block_content_type_render($subtype, $conf) {

inside this function you have the lines: (lines 145 -146 )
$block = (object) $block;
}

you need to change those two lines to: (Replace them)
}
$block = (object) $block;

inside this function you have the line: (line 155)
if ($module == 'block') {

you need to change this line to:
if ($module == 'block' && !empty($info) && isset($info->title)) {

If something went wrong return the old file.
good luck.

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Needs review

I have applied the #32 poster's patch and am still seeing this issue in Drupal 7.17 - is anyone else seeing this problem still with Drupal Core 7.17 after applying this patch?

NOTE: I took the poster number #51's advise and changed the:

$block = (object) $block;
}
to

}
$block = (object) $block;

It reduced the errors but I am still seeing one:

Notice: Trying to get property of non-object in ctools_block_content_type_render() (line 156 of /var/www/sites/all/modules/ctools/plugins/content_types/block/block.inc).

Final update (issue resolved):

I took poster # 72's advise and it resolved the final error for me:

inside this function you have the line: (line 155)
if ($module == 'block') {

you need to change this line to:
if ($module == 'block' && !empty($info) && isset($info->title)) {

Ideally, these should be rolled up for the latest update to be compatible with 7.17 core. I thought I would put my experience here for other's knowledge and acknowledgement of those that helped resolved the issue above.

#72 fixed it for me

Hi Would be great if #72 would be set up as a patch to latest .dev. I am on travel so no go for me.
greetings, Martijn

Version:7.x-1.2» 7.x-1.x-dev
Status:Needs review» Closed (fixed)

Already in dev:
http://drupalcode.org/project/ctools.git/commitdiff/03f10455c9ca38c152b3...

Maybe changing the version will help to stop people reopening this issue over and over again.

#72 worked for me on Drupal 7.17

#72 worked for me too on Drupal 7.17

#72 worked for me also on Drupal 7.17

#72 worked for me also on Drupal 7.17. Thank you.

using the patch on #1 saves my day. thank you.

I don't want to re-open this issue. I just need to know HOW to apply the patch.

I tried applying it like adding a module through the admin. I also looked up how to add a patch to c-tools but cannot find the information.

C-tools is installed and everything is checked off. How do I give it this information? I do not see a c-tools folder anywhere. Do I do it manually through the ftp?

(Drupal 7.1.5 not in dropdown box to choose.)

@bemery
How to apply a patch:
http://drupal.org/patch/apply

Contrib modules are usually located in sites/all/modules, so you probably find the ctools folder there.

The patch is already committed to dev
Since the patch posted in this issue has already been committed (see #43 and the commit), you can save your time of trying to apply the patch by downloading the latest 7.x-1.x-dev, where the fix is already included (or you must have a good reason by not using the latest dev).

#72 works for me. Thanks for the explanation in words for us newbies.

#72 works for me too , drupal 7.17

@merlinofchaos, it's been a while since this was fixed in dev but not in the latest release. I think we're due for a 7.x-1.3 release?

Способ из сообщения #72 работает

#72 also worked for me!

I don't want to add to a fixed item, but for those still looking until the next release, I found that simply going into the block and setting the title to <none> fixed the issue I was having. I had a custom menu as a panel-pane and had these errors and the menu pane wouldn't appear.... but setting the title to something (or <none> in the Drupal blocks admin area seemed to fix it.

Just in case this helps anyone else.

Perfect, this fixed the problem, thank you so much!

#72 FTW! Worked for me. (7.10)

D7 (7.20) clean install with ctools (7.x-1.2) installed and enabled.

Warning: Attempt to assign property of non-object in ctools_content_render()

I got this message after adding content (selecting a menu) into a landing page created in Panels (7.x-3.3).

#66 - is it fixed?

#72 worked for me too.

This was committed over 6 months ago here:

http://drupalcode.org/project/ctools.git/commitdiff/03f10455c9ca38c152b3...

But there hasn't been a 7.x-1.3 release yet that would include this fix.

You can follow #1932458: Blockers to a 7.x-1.3 release? to see when 7.x-1.3 will be released.

#72 worked for me

#72 Worked for me. Thanks so much. Hope to see the update soon!

#72 worked and for me. Is unusual, on the other site the same thing works without problems.

72 worked for me.

Good news! 7.x-1.3 has been released!

This latest release contains the fix for this issue.

PLEASE DO NOT ADD COMMENTS about #72 working for you.