I started getting a ton of the following notices after I updated to 1.2 earlier today.

Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 660 of /sites/all/modules/field_group/field_group.module). Backtrace:

field_group_field_group_pre_render(Array, Array, Array) field_group.module:2021
field_group_pre_render(Array, Array, Array) field_group.module:1991
field_group_fields_nest(Array, NULL) field_group.module:1884
field_group_build_entity_groups(Array, 'form') field_group.module:1854
field_group_form_pre_render(Array) common.inc:5843
drupal_render(Array) common.inc:5871
drupal_render(Array) common.inc:5871
drupal_render(Array) common.inc:5963
render(Array) page.tpl.php:80
include('/htdocs/sites/default/themes/mytheme/templates/page.tpl.php') theme.inc:1517
theme_render_template('sites/default/themes/mytheme/templates/page.tpl.php', Array) theme.inc:1201
theme('page', Array) common.inc:5864
drupal_render(Array) common.inc:5726
drupal_render_page(Array) common.inc:2675
drupal_deliver_html_page(Array) common.inc:2563
drupal_deliver_page(Array, '') menu.inc:532
menu_execute_active_handler() index.php:21

And I was wondering if there was a typo on line 636 shouldn't

function field_group_field_group_pre_render(& $element, &$group, & $form) {

Be:

function field_group_field_group_pre_render(&$element, &$group, & $form) {

Notice the space between the & and $element.

Thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nils.destoop’s picture

Hmm. You sure the line numbers are correct?
On line 660, there is nothing of code, only documentation of the field_group_pre_render_fieldset function.
Also the other line numbers don't match.

Dave Reid’s picture

I can confirm we're also getting a bunch of notices with using ECK entities with Inline Entity Form as a result of the update:

Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2057 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2059 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2063 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Warning: Attempt to assign property of non-object in field_group_pre_render_prepare() (line 617 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Warning: Attempt to assign property of non-object in field_group_pre_render_prepare() (line 618 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 636 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 646 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 649 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 652 of /home/dave/Sites/deims.dev/www/sites/all/modules/field_group/field_group.module).
Dave Reid’s picture

Seems to be a problem with Inline Entity Form is being used. The entity that is inside the inline form doesn't have any field groups on it, but somehow that's what is causing all the errors.

ath.galanis’s picture

The same problem for me too. (after update to 7.x-1.2).

royerd’s picture

Yes, me as well. Yikes.

Christopher Riley’s picture

I downgraded to 7.x-1.1+68-dev and the problems went away. As soon as I get my dev server back up and running I can run more extensive tests but I can't do that in production.

Stalski’s picture

I can't seem to reproduce this. I tried with upgrades from 7.x-2.x to 7.x-1.2 and from 7.x-1.1 to 7.x-1.2.
Looking at the code on the lines Dave subscribes, it seems like it's no group object at all, most likely a NULL value. Group->group_name is always known if the group was succesfully loaded from the database.

Can anyone give some more pointers on how to reproduce?

ath.galanis’s picture

Scenario that reprodusing the above notises
On Drupal 7.23 with Flag 7.x-1.2 AND String Overrides 7.x-1.8 module enabled

Go Configuration > Regional & Language > String Overrides
Update/change anything or just click save
Go instantly to your home page and you get the notises

The fact is that I'm not get the notises anymore (with the above scenario).

Christopher Riley’s picture

I was getting it on the users screen as well as the checkout panes in Drupal Commerce.

c3rberus’s picture

I just updated to the latest version of field_group running latest version of Drupal 7 and am getting the same errors.

Something real funky going on, the content type that I am working with has a file field, when I add a new node with a file content, my screen is spammed with the "Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 636 of /var/www/sites/all/modules/field_group/field_group.module)." but the file gets added.

When I drill into the node, I also cannot see the file even though my display settings are set to show the genetic file.

Nodes under the same content type that have been added prior to the field_group update, show the file there.

Just trying to provide as much information as I can to help resolve this.

This same content type makes use of field_collection and conditional_fields, though up until this update there were no problems.

c3rberus’s picture

Just an update, the issue regarding the "file" not getting added is not related to this error (it was an issue with my conditions on the file field).

I also noticed that if I update to the latest --dev version instead of the stable, the errors stop but I also lose the ability to drag fields around.

fortis’s picture

I am getting the same errors with update from 1.1 to 1.2,
rolled back to 1.1

Plascual’s picture

Same thing here. I mostly get the messages when I'm on the Verify pane of Drupal Commerce.

How may I help?

T.Mardi’s picture

I've also started to get these errors since upgrading to 1.2. They mostly appear on Commerce checkout pages:

    Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2064 of /sites/all/modules/field_group/field_group.module).
    Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2066 of /sites/all/modules/field_group/field_group.module).
    Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2070 of /sites/all/modules/field_group/field_group.module).
    Warning: Attempt to assign property of non-object in field_group_pre_render_prepare() (line 617 of /sites/all/modules/field_group/field_group.module).
    Warning: Attempt to assign property of non-object in field_group_pre_render_prepare() (line 618 of /sites/all/modules/field_group/field_group.module).
    Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 636 of /sites/all/modules/field_group/field_group.module).
    Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 646 of /sites/all/modules/field_group/field_group.module).
    Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 649 of /sites/all/modules/field_group/field_group.module).
    Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 652 of /sites/all/modules/field_group/field_group.module).
    
wrd’s picture

I'm actually getting these notices even on a content type from which I've removed all field groups. The only content type on which I'm seeing these notices is one that uses a Field Collection. (The Field Collection also does not have any field groups.)

DeFr’s picture

OK so what seems to be going on is: field_group_fields_nest assumes that everything mentionned in $element['#groups'] is a field group. Core is already using '#groups' though in form_process_fieldset, putting an array there instead, every time a fieldset using the standard FAPI #group property is used.

This seems to be known and is documented in the field_group.api.php, and seems to be the reason why there's both '#fieldgroups' property, but I'm not sure why it wasn't used. Using it seems to fix the problem, attaching a proof-of-concept patch.

wrd’s picture

#16 seems to clear the problem up for me.

daniel-san’s picture

#16 worked.

I was getting the notices on the content type's Manage Fields page and all of the field groups were not showing up on the Node add or edit page. The notices/errors have cleared and the field groups are now showing on node edit page.

glynster’s picture

I can confirm this fixed the issue for us as well.

eneko1907’s picture

#16 did the trick for me too -- no more notices or vanishing tabs. THANKS.

micbar’s picture

Status: Active » Reviewed & tested by the community

#16 works fine. I think this is rtbc.

Dom.’s picture

To #16:

I would also add this one lign 1841:

foreach ($element['#groups'] as $group_name => $group) {
    foreach ($group->children as $child) {

to

foreach ($element['#fieldgroups'] as $group_name => $group) {
    foreach ($group->children as $child) {
DeFr’s picture

That one is following a straight assignment to $element['#groups'] four line above, so at this point $element['#groups'] is guaranteed to be the same as $element['#fieldgroups'] and I'm not too worried about it.

The call in

  foreach ($element['#groups'] as $group) {
    if (!empty($element[$group->group_name]) && $type != 'user_profile') {
      $vars['content'][$group->group_name] = $element[$group->group_name];
    }
    elseif (!empty($element[$group->group_name])) {
      $vars['user_profile'][$group->group_name] = $element[$group->group_name];
    }
  }

feels a bit unsafe, but that code is only hit for non-form case, so it should be immune to FAPI-conflict.

Dom.’s picture

Thanks for reply and precision, sorry for the time it took you !

Jelle_S’s picture

This has been fixed in the past, but was then reverted two commits later (see #1006464: field_group not working on user registration and add people form of profile2). This commit also seems to re-introduce the '#groups' array key.

FYI / FWIW: I can confirm this patch is working

SocialNicheGuru’s picture

i can confirm it works too

eneko1907’s picture

Actually, with #16, I am still seeing a bunch of notices -fewer than before-.

Here is one from watchdog:

Referrer http://drupal-root/test-field-group-notices
Message Notice: Trying to get property of non-object in field_group_fields_nest() (line 1959 of [path]/modules/contrib/field_group/field_group.module).

I took care of this after doing a similar replacement around line 1959 (#groups to #fieldgroups)
and now I do not see notices - tested twice.

here is a revised patch.. let me know if that helps some of you.
inigo

dmitrii’s picture

#27 works for me

Stalski’s picture

Hi all,

The solution to use something other than #groups is the best one. We had some kind of workaround in the past to avoid a clash between fieldgroup #groups and the #groups used by several modules to create a fieldset with properties (E.g. user profile history).
I'll review the patch so I can take a look at how we merge the #fieldgroups into #groups before. But I think the proposed patch is the good approach.

c3rberus’s picture

This is good news, waiting for this to get committed to dev so I can update :)

hcderaad’s picture

#27 works!

John Pitcairn’s picture

Sigh. Patch at #27 works here.

No it doesn't. Still getting errors when viewing some nodes with an embedded field collection.

micbar’s picture

Status: Reviewed & tested by the community » Needs work
nils.destoop’s picture

I committed #27 to dev, as renaming #groups to #fieldgroups is the correct way to go. This way most of notices are already gone, we will now check for embedded field collection.

nils.destoop’s picture

Can't seem to reproduce the notices when viewing a node with embedded field collection.
Can you say the display settings of your collection?

John Pitcairn’s picture

It's a multivalue field, and output is highly customized. I think this is one I'll have to investigate myself, the problem may be mine ;-)

Dave Reid’s picture

We're encountering this using the Inline entity form multiple value widget for entity reference fields to refer to one type type on another. The parent node type has field group configuration added to it, but the inline node type does not have any field groups.

MVRider’s picture

I have the same issue as as #37 and will be watching this thread.

TimeBandit’s picture

Was getting same errors with nested embedded field collections after update. DEV update from 2013/09/11 eliminated the errors for me.

nils.destoop’s picture

Title: Started getting a ton of notices » Notices when using embedded field collections or Inline entity form multiple value widget

I'm setting this to fixed then. People already confirmed that it was fixed for inline entity form, now also for embedded field collection.

nils.destoop’s picture

Status: Needs work » Fixed
Sam152’s picture

Status: Fixed » Needs work

Can you commit this against a stable release? The current stable release is broken and people might not want to be on the dev branch.

Christopher Riley’s picture

Patch fixed my issues and gave me control of the server again. Can we please get this committed?

nils.destoop’s picture

Status: Needs work » Fixed

Moving this back to fixed. A 1.3 stable is gonna be released soon.

Ravi.malviya2000’s picture

i have userd #34 and resolved problem as renaming #groups to #fieldgroups is the correct way to go. This way most of notices are already gone, we will now check for embedded field collection.

prorokxp’s picture

Version: 7.x-1.2 » 7.x-1.3
Status: Fixed » Active

I have simillar ton of notices on the commerce "Review order page" (checkout/10/review)
product has Inline Entitie Single widget.

all modules are up to date.

field_group_table + field_group modules as you can see:

Notice: Trying to get property of non-object in field_group_table_field_group_pre_render() (line 154 of /sites/all/modules/field_group_table/field_group_table.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2057 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2059 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2063 of /sites/all/modules/field_group/field_group.module).
Warning: Attempt to assign property of non-object in field_group_pre_render_prepare() (line 617 of /sites/all/modules/field_group/field_group.module).
Warning: Attempt to assign property of non-object in field_group_pre_render_prepare() (line 618 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 636 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 646 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 649 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_field_group_pre_render() (line 652 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_table_field_group_pre_render() (line 154 of /sites/all/modules/field_group_table/field_group_table.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2057 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2059 of /sites/all/modules/field_group/field_group.module).
Notice: Trying to get property of non-object in _field_group_get_html_classes() (line 2063 of /sites/all/modules/field_group/field_group.module).

prorokxp’s picture

Status: Active » Closed (fixed)

sorry, my mistake.. was not upgraded actually. notices has gone in 1.3
thanks. great work

lauriii’s picture

Status: Closed (fixed) » Active

After succesful upgrade to 1.3, i'm getting these errors:

Notice: Undefined index: group_other_users in field_group_fields_nest() (line 1975 of /sites/extranet/modules/contrib/field_group/field_group.module).
Notice: Trying to get property of non-object in field_group_fields_nest() (line 1975 of /sites/extranet/modules/contrib/field_group/field_group.module).
xaviemirmon’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
971 bytes

I have created a patch which fixes the notices I was getting. Let me know if that works.

Status: Needs review » Needs work

The last submitted patch, 49: 2078201-49-fieldgroup_notice_flood.patch, failed testing.

Dave Reid’s picture

Status: Needs work » Closed (fixed)

Please file a separate issue for the bug and patch in #48 and #49 since this issue was marked as fixed, and the PHP notices reported in #48 are different from the ones originally reported.

  • Commit 789262e on 7.x-1.x, 8.x-1.x authored by eneko1907, committed by zuuperman:
    Issue #2078201 by DeFr, eneko1907 | cmriley: Fixed Started getting a ton...

Status: Closed (fixed) » Needs review

Status: Needs review » Needs work

The last submitted patch, 49: 2078201-49-fieldgroup_notice_flood.patch, failed testing.

The last submitted patch, 16: 2078201-14-fieldgroup_notice_flood.patch, failed testing.

The last submitted patch, 27: 2078201-27-fieldgroup_notice_flood.patch, failed testing.

Dave Reid’s picture

Status: Needs work » Closed (fixed)