Invalid Argument supplied for each - line 127

drutube - April 24, 2008 - 20:19
Project:CCK Field Privacy
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:obsidiandesign
Status:closed
Description

warning: Invalid argument supplied for foreach() in /home/academic/public_html/devmain/sites/all/modules/cck_field_privacy/cck_field_privacy.module on line 127.

I got this in the release and dev version as well.

I configured the cck privacy to only apply to user profile or uprofile content type.

AttachmentSize
uprofileerror.png26.89 KB

#1

drutube - April 24, 2008 - 20:30

I tried the 5.2 version just to see if it would solve the issue and it gave the exact same error.

#2

obsidiandesign - April 24, 2008 - 23:53

I've attached a patch to try - the warning doesn't actually appear on my box, but looking at the image, I think the error is generated because the module isn't selective enough about what the user profile form is. This patch checks to see if the nid is set according to the page_form.

Let me know if it works & then I'll commit.

AttachmentSize
cck_field_privacy.module.patch 829 bytes

#3

obsidiandesign - June 28, 2008 - 05:45
Status:active» fixed

I've committed the patch, marking the bug fixed.

#4

Anonymous (not verified) - July 12, 2008 - 05:52
Status:fixed» closed

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

#5

radj - October 26, 2008 - 14:37

whew...did the error mean anything else other than a warning?

#6

mafioso - December 23, 2008 - 11:34
Version:5.x-1.x-dev» 5.x-1.3
Status:closed» active

obsidiandesign,

it happens again... the patch from #2 is missing in 5.x-1.3 :)

#7

obsidiandesign - December 24, 2008 - 02:07

It seems that the original fix never made it into the 5.x-1.x branch. That said, I'm not sure it's the best approach anyway, since it limits the module to working with User Profile. Could you please test this patch, to see if it makes the error go away? The error comes about because a foreach() is executed against the cckfp_values variable, which if there are no selected fields, is an empty string right now, rather than an empty array.

Hopefully the patch addresses the REAL issue at hand here. :) Thanks for your help.

Bryan O'Shea
Obsidian Design

AttachmentSize
cck_field_privacy.module.250873.patch 678 bytes

#8

bcobin - December 31, 2008 - 17:10

Patch seemed to work on dev site, not on deployed site. I get the same error. Could have something to do with drop-down fields being unselected - will investigate...

#9

Prodigy - January 5, 2009 - 21:08

You will get this error if you have not selected any of the fields on the admin >>cck field privacy page.

In other words, make sure you have selected at least 1 field to use privacy for. I don't see anything wrong with this because if nothing is selected the module shouldn't be enabled for that content type. Thanks!

#10

bcobin - January 5, 2009 - 23:40

Thanks, Prodigy - that clears things up! Good work on the module!

#11

obsidiandesign - January 7, 2009 - 01:22
Version:5.x-1.3» 6.x-1.x-dev
Priority:normal» minor
Assigned to:Anonymous» obsidiandesign
Status:active» needs review

I'd like to mark this by design or won't fix, but at the same time, it is an error message that is confusing to the end user. Does the patch from #7 fix the issue for other people? If so, I'll commit it, because even if an admin enables the module & doesn't use it, it should not give off error messages. I just want to make sure it's fixed correctly this time.

Bryan O'Shea
Obsidian Design

#12

bcobin - January 7, 2009 - 15:50

Once fields were enabled, it doesn't throw the error message - we'll be testing it further. This is with Nodeprofile, not Bio.

I've made one immediate change to the display field in the js (changing "Privacy Setting" to "Allow this field to be seen by:"); there are three other suggestions that I'll submit as feature requests.

Thank you for a very cool - and necessary - module... looking forward to using it!

#13

obsidiandesign - January 10, 2009 - 18:00
Status:needs review» fixed

The code from the patch in #7 has been applied to both the 5.x and 6.x branches, as testing on clean installs showed no 'Invalid Argument' errors. The next dev release will have the change, and it's available now in CVS.

Bryan

#14

System Message - January 24, 2009 - 18:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.