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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Status: Active » Needs review
FileSize
629 bytes

This patch should fix that.

merlinofchaos’s picture

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

drupalycious’s picture

Hello,

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

thanks for the patch!

ntigh52’s picture

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

drupalycious’s picture

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

IshaDakota’s picture

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

eule’s picture

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;
  }
rickmanelius’s picture

I applied the patch. Works like a charm!

ntigh52’s picture

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.

elBradford’s picture

Patch seems to remove the warnings for me. Thank you

pjbarry21’s picture

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

justadropofwater’s picture

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

ethnovode’s picture

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.

bpeicher’s picture

Patch worked for me.

agerard’s picture

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

merlinofchaos’s picture

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

imoreno’s picture

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

eule’s picture

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

danjuls’s picture

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

BenVercammen’s picture

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

ntigh52’s picture

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.

arturs.smirnovs’s picture

Thanks! #1 and #21 helped me.

alanom’s picture

#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;
  }
kenheim’s picture

#1 and #23 worked for me

ntigh52’s picture

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

IshaDakota’s picture

Status: Needs work » Needs review
FileSize
940 bytes

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

rickmanelius’s picture

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.

merlinofchaos’s picture

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

ntigh52’s picture

whats about function ctools_user_login_pane_render line 484?

IshaDakota’s picture

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?

merlinofchaos’s picture

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

  if ($module == 'block' && !empty($info) && isset($info->title))
IshaDakota’s picture

right, of course. Thanks.

This should do then.

hackwater’s picture

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

deepbluesolutions’s picture

cleared the problem for me! +1

rickmanelius’s picture

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.

ntigh52’s picture

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

ntigh52’s picture

@eule, whats about you?

Screenack’s picture

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

eule’s picture

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

eule’s picture

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

xbrianx’s picture

I assume an update will be posted soon.

Summit’s picture

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

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed.

mapruter’s picture

#32 worked for me as well!

sanchiz’s picture

Thanks! #32 working patch, solved the problem

augenbrauezug’s picture

#20 worked best for me

nabilb’s picture

Hi there,

Can you help on 7.14 or 7.15 version.

thanx

ntigh52’s picture

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

jaykainthola’s picture

@BenVercammen Thanks, It work for me.

enricotersi’s picture

#32 working for me also, thanks!

ccbearyeh’s picture

My core is 7.15
I switched the lines from

$block = (object) $block;
   } 

to

 }
$block = (object) $block;

and it's work for me.

omaster’s picture

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

kafitz’s picture

#32 worked for me (drupal core version 7.15)

dddave’s picture

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

seoDemon’s picture

Status: Fixed » Needs review

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

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

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

merlinofchaos’s picture

Why are we retesting and marking RTBC already committed patches?

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed
inventa’s picture

Status: Fixed » Needs review

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

ar-jan’s picture

Status: Needs review » Fixed

Really...

dddave’s picture

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.

MichaelCole’s picture

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

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

ashii’s picture

#21 worked fine, Thanks a bunch.

thejtate’s picture

#32 worked great for me.

amjad1233’s picture

#32 worked for me should goto module update

dddave’s picture

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

stevesmename’s picture

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.

merlinofchaos’s picture

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.

curtispenner’s picture

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?

dddave’s picture

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

ntigh52’s picture

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.

MikeDzl’s picture

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.

Draven_Caine’s picture

#72 fixed it for me

Summit’s picture

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

MegaChriz’s picture

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.

LeviThomason’s picture

#72 worked for me on Drupal 7.17

JeniferTucker’s picture

#72 worked for me too on Drupal 7.17

axle_foley00’s picture

#72 worked for me also on Drupal 7.17

espurnes’s picture

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

odyseg’s picture

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

bemery’s picture

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

MegaChriz’s picture

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

smileeman2002’s picture

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

aalireza’s picture

#72 works for me too , drupal 7.17

fizk’s picture

@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?

AndreyMukha’s picture

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

radj’s picture

#72 also worked for me!

christoph’s picture

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.

cesabal’s picture

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

jswazzer’s picture

#72 FTW! Worked for me. (7.10)

JeniferTucker’s picture

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.

fizk’s picture

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.

oliverpolden’s picture

#72 worked for me

eckersley’s picture

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

vandam-me’s picture

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

rwoldezghi’s picture

72 worked for me.

fizk’s picture

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.

c2webdev’s picture

ntigh52 #72

http://drupal.org/node/1739718#comment-6613292

work for me!

thanks

c2webdev’s picture

I am using 7.1.3 and the CTOOLS issue was there.