I'm getting this notice error often, also shows up after an update.php process has completed

Notice: Undefined index: flagging in views_handler_field_field->access() (line 127 of /.../drupal/sites/all/modules/views/modules/field/views_handler_field_field.inc).
Notice: Undefined index: flagging in views_handler_field_field->access() (line 127 of /.../drupal/sites/all/modules/views/modules/field/views_handler_field_field.inc).
Notice: Undefined index: flagging in views_handler_field_field->access() (line 127 of /.../drupal/sites/all/modules/views/modules/field/views_handler_field_field.inc).

drupal 7.31 (new update)
php 5.4.28
conditional field-7.x-3.0-alphal1 (new use)
field validation 7.x-2.4
flag 7.x-3.5
optional mail on register (new use)
ctools 7.x-1.4

Comments

operawong’s picture

Issue summary: View changes
alberto56’s picture

Version: 7.x-3.8 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
114.96 KB
665 bytes
None View

This error creeps up once in a while: [#2031477], #2129841: commerce field in a view generates Notices : Undefined index: node in views_handler_field_field->access() (line 127 in /var/www/mysite/sites/all/modules/views/modules/field/views_handler_field_field.inc)..

In my case, it happens when I run automated tests in a module which has, as a dependency, a feature which defines a view which itself requires third-party module. In some cases this results in a missing handler during the installation process, even though after the installation is complete and the cache is cleared, everything works as expected.

See an example in the image enclosed.

Here is a patch which checks if the handler is available before checking for access. If the handler is not available then the access is presumed to be false be no error is thrown.

MrPaulDriver’s picture

Albert. Please could you tell me against which module your patch should be applied?

alberto56’s picture

@MrPaulDriver should be against the root of the views module.

MrPaulDriver’s picture

No file to patch?

---

Pauls-MacBook-Pro:views pauldriver$ patch < 2331209-2-views-7.x-3.x-undefined-index.patch
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/modules/field/views_handler_field_field.inc b/modules/field/views_handler_field_field.inc
|index a91e13a..bf1fcd3 100644
|--- a/modules/field/views_handler_field_field.inc
|+++ b/modules/field/views_handler_field_field.inc
--------------------------
File to patch: 
alberto56’s picture

@MrPaulDriver, you need to add -p1, like this

patch -p1 < 2331209-2-views-7.x-3.x-undefined-index.patch

You will find more information about patching here.

Cheers,

Albert.

MrPaulDriver’s picture

Thank you Albert, please excuse my ignorance.

Ismail Cherri’s picture

Thank you! You saved me a great headache :)

333martine’s picture

@alberto56: thank you very much for posting the patch solution. It worked :)

ccbearyeh’s picture

Thank you so much, this patch works.

Dave Kopecek’s picture

Thank you alberto56 !! Patch works in #2. Wow. This had me stumped.

DarrellDuane’s picture

Status: Needs review » Reviewed & tested by the community

This patch fixed this error for me as well. Let's commit this patch! Thanks Alberto56

DarrellDuane’s picture

@Dave Kopecek, @ccbearyeh, @333martine, @Ismail Cherri, the next time you download a patch and it fixes something for you, please change the status to Reviewed & tested by the community so that the views maintainers know to included it in the next release of views. This issue has remained in views longer than it needed to and affected others 'cos no one knew that it was fixed by this patch.

pthornhi6’s picture

+1 - I had this same problem. The patch got rid of the error. But it still seems like something is wrong upstream. Seems like I shouldn't arrive to that function without a handler being available.

colan’s picture

We've recently switched our testing from the old qa.drupal.org to DrupalCI. Because of a bug in the new system, #2623840: Views (D7) patches not being tested, older patches must be re-uploaded. On re-uploading the patch, please set the status to "Needs Review" so that the test bot will add it to its queue.

If all tests pass, change the Status back to "Reviewed & tested by the community". We'll most likely commit the patch immediately without having to go through another round of peer review.

We apologize for the trouble, and appreciate your patience.

nico.knaepen’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
853 bytes

Re-uploaded patch and set status to "Needs review".

alberto56,

Your patch works fine on my site. Thnx for patching.

Status: Needs review » Needs work

The last submitted patch, 16: 2331209-3-views-7.x-3.x-undefined-index.patch, failed testing.

jeromewiley’s picture

So, if it failed testing (#17), should I apply it to my site or not?

nico.knaepen’s picture

Status: Needs work » Needs review
FileSize
665 bytes

@jeromewiley,

I've added a new patch. The previous patch path was incorrect. That's the reason why it wouldn't apply.

massiws’s picture

Notice: Undefined index: users in views_handler_field_field->access() (line 127 of /.../sites/all/modules/contrib/views/modules/field/views_handler_field_field.inc)

I get this error message on any page when clearing cache.
Applying patch #2 don't fix the problem.

maxplus’s picture

Hi,
using the patch from #19 solved this issue for me,

Thanks!

scottsawyer’s picture

patch in #19 removed the notice for me.

webservant316’s picture

#19 works for me.

Jigar.addweb’s picture

Issue summary: View changes
webservant316’s picture

I manually reapplied patch #19 to views 7.x-3.14. Any chance of getting this committed?

nico.knaepen’s picture

@webservant316,

You could help it getting commited by reviewing it and putting the status in "Reviewed & tested by the community". Then it's up to the authors to commit the patch.

Regards,

Nico

webservant316’s picture

Status: Needs review » Reviewed & tested by the community

works for me.

vinay3a’s picture

@alberto56: Thanks it works for me

betz’s picture

I can confirm this is working as expected on 3.14

prafull.addweb’s picture

Issue tags: +undefined index, +views
kclarkson’s picture

I love the Drupal Community!

Fixed my issue on 3.14.

deepak_zyxware’s picture

This works fine for me.

jprj’s picture

I've still got the problem (using 3.14). It only pops up when I run update.php. I've not done any real diagnosis - so I need to have a look. Just to clarify - I've not tried deepak_zyxware's patch. Will have a look at it (but it won't be overnight...!)

colan’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

@deepak_zyxware: What's the difference between #19 and #32? Please explain why you're posting a patch on top of an RTBCed one, and/or use interdiffs.

Also, can someone tell me if this is also an issue in D8? If so, we need to create another issue for that. Thanks.

pburst’s picture

If the patch above does not work, try this:
>> this seemed to happen when in /admin/structure/views/view/commerce_cart_summary/edit/default you added commerce line item under FIELDS the customized line item type "whatever it is"
>> go to views /admin/structure/views and look for this: Shopping cart summary
>> hover over the EDIT link in the right side, then on dropdown, click revert
>> click edit (/admin/structure/views/view/commerce_cart_summary/edit/default) and place back the commerce line item "whatever it is"

CmKeen’s picture

I've tested both patch #19 and #32 and I still have the error.
Any idea on what it could be?

TX

scottsawyer’s picture

FYI, I just updated views from 3.14 to 3.15, it reverted this patch, error returned. Once I re-applied patch in #19, errors go away.

webservant316’s picture

what is the hold up on the patch in #19? I am upgrading to views 3.15, but now need to re-patch.

echoz’s picture

The patches from #19 + #32 are identical.

DamienMcKenna’s picture

Dave Kopecek’s picture

#19 works for me against 7.x-3.16. Tested & now 24 hour on production site with no errors where errors were occurring regularly pre-patch.

Dave Kopecek’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community
Kris77’s picture

#19 works for me too with 7.x-3.15.

Thanks @nico.knaepen