Invalid Argument

kernphilip - June 23, 2008 - 20:48
Project:Signup Status
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:jrbeeman
Status:won't fix
Description

* warning: Invalid argument supplied for foreach() in .../modules/signup_status/signup_status.module on line 374.
* warning: Invalid argument supplied for foreach() in .../modules/signup_status/signup_status.module on line 425.

This notice occurs when viewing a signup form and no status codes are set to "Modify the total signup count"

#1

DeFr - November 12, 2008 - 13:58
Status:active» needs review

Attached patch checks that $codes really is an array before calling foreach on it, thus removing the warnings. It doesn't change the behavior.

AttachmentSize
273972.patch 1.71 KB

#2

jrbeeman - November 19, 2008 - 19:49
Version:5.x-1.x-dev» 6.x-1.x-dev
Assigned to:Anonymous» jrbeeman

#3

DeFr - December 2, 2008 - 13:11

In fact, the following patch moves the fix to the signup_status_codes function, making sure that it always return an array even if no status matched the given conditions. It should be more generic and remove the need to check if the result was an array or not from every caller. (patch made against the 5.x-1.1 release)

AttachmentSize
273972-3.patch 389 bytes

#4

dww - September 22, 2009 - 16:06
Version:6.x-1.x-dev» 5.x-1.x-dev
Status:needs review» won't fix

I just tested this in D6 in two configurations:

A) new site with _no_ status codes defined at all.

B) new site with some status codes defined, but none of them are configured to "Show on form".

In both cases, there are no PHP notices or warnings. I think this is a D5-only bug at this point.

I'm not maintaining the D5 version of signup_status at all. The D6 version has been a nearly complete re-write to make this code properly integrate with the main signup.module. I think "won't fix" is the appropriate status here, since I don't know if any of the signup_status maintainers are still working with the D5 version...

 
 

Drupal is a registered trademark of Dries Buytaert.