Hi there,

First of all, this module ROCKS. I've been building a class registration site for the last several months and just found this. its great!

So I did a quick mock-up on my test site and everything works wonders, except after the user sucessfully purchases a signup node, I get the following error returned:

"warning: Invalid argument supplied for foreach() in /home/seanport/public_html/porterworkstest/sites/all/modules/signup/theme/email.inc on line 41."

not knowing what this was about, I went through and checked all my email fields in both signup and ubercart, and didn't see anything. Doesn't seem to affect whether or not the transaction was successful, but I could see it concerning an end-user.

Any ideas?

Thank you!
Sean

Comments

dww’s picture

Project: Signup » Signup Integration for Ubercart
Version: 6.x-1.0-rc4 » 6.x-1.x-dev
Component: Database » Code
Category: support » bug

Perhaps a bug in signup_uc... I've never seen that error when just using signup, so I'm guessing that's the culprit. I haven't tried out signup + UC at all (i've never touched UC, in fact).

ezra-g’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

I'm not really sure what the problem is so here's a slew of questions:

a)Are you using uc_signup?
b) Can you clarify how you've configured uc_signup with Signup and Ubercart?
c) In general if you're using the form that signup.module provides to enter data for a uc_signup-enabled node, that's not correct.
d) Have you customized the signup.module signup form at all?

ezra-g’s picture

Status: Postponed (maintainer needs more info) » Fixed

I'm marking as fixed due to a lack of response. Please re-open if you're still having problems.

xeraseth’s picture

Status: Fixed » Active

I am having the same issue. Any update on this?

dww’s picture

Status: Active » Postponed (maintainer needs more info)

There's no update until someone having this problem answers the questions ezra-g asked in #2 about how your site is configured and how you can reproduce the problem. Please provide more details then someone might be able to help...

xeraseth’s picture

I am just configuring the module. I didn't install or setup the Drupal site so I will answer them to the best of my ability.

a) Yes
b) Its the default setup except that I disabled the condition action that cancel signups when there is still a balance left
c) I don't believe I am, everything that I am using is via the Store Administration Page.
d) No

ezra-g’s picture

Hmm. I'm not quite sure what the problem is from this description.

Can you clarify what you mean when you say "I went through and checked all my email fields in both signup and ubercart,", specifically as it relates to signup?

Also, does this still happen if you update to the latest release of signup and uc_signup?

sean porter’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta4

@ezra-g

I've confirmed that I'm still getting this error message. I'm currently using testing gateways, paypal web payment standard sandbox and the credit card test gateway.

The error does not display when using paypal sandbox. It does show up when I'm using the credit card gateway.

Order complete
warning: Invalid argument supplied for foreach() in /home/seanport/public_html/porterworkstest/sites/all/modules/signup/theme/email.inc on line 41.

Your order is complete! Your order number is 12.

Thank you for shopping at PorterWorks. While logged in, you may continue shopping or view your current order status and order history.

Return to the front page.

Signup 6.x-1.0-rc5 (email confirm module enabled)
UC_signup 6.x-1.0-beta4
UC 6.x-2.0-rc6

a)I am using beta4 of the uc_signup module
b)I've installed signup, applied it to the content type I'd like to use. I have it set not to use the signup form, and not to display any signup information, except for admins. I've got UC_signup installed and it showing up correctly in the products section of the Store Admin menu. I don't have it doing anything fancy except changing the add to cart text to "register"
c)I'm not using the signup form from the signup module.
d)not at all

When I mentioned the email fields, I was just shooting in the dark because the error message mentioned the email.inc file, so not knowing the first thing about module coding, I just went through the couple email fields in Signup and Ubercart and made sure there weren't mistypes or format errors, etc.

My next big challenge is getting signup to recognize payments made via Ubercart + paypal standard. at least when using the sandbox signup doesn't add the user as "signed up" but that's another issue...

Thanks for you're help, sorry about the delay, been stuck on another project for many weeks and just now coming back to this...

ezra-g’s picture

Does it go away if you disable the email confirm module?

sean porter’s picture

Just tried it - yes still an issue. cleared cached data and tried again with same result.

sean porter’s picture

Any update on this issue?

ezra-g’s picture

Sorry, but it's tough to tell how you're generating this particular error depending on which payment gateway you're using.

I suggest either

A) Doing a debug_backtrace() from where the error is occurring

or

B) trying to reproduce with a fresh install

ezra-g’s picture

Or, maybe try replacing the signup folder with a fresh tarball first.

ezra-g’s picture

Status: Postponed (maintainer needs more info) » Fixed

Let me know if replacing signup.module didn't help, otherwise I'm marking this as fixed.

Thanks!

visuaLatte’s picture

Status: Postponed (maintainer needs more info) » Fixed

I am having this same problem. I get the error: warning: Invalid argument supplied for foreach() in ... /sites/all/modules/signup/theme/email.inc on line 41. My setup is also with Ubercart and UC_Signup. I am wondering whether this is an issue where UC_Signup is providing faulty data somehow to the main Signup module, because it's obviously missing something.

Also, I have noticed that although sign-ups are ultimately successful (they get logged properly, and all the data is in the right place), the confirmation email always fails to send (unsurprisingly, given that the error is from the file 'email.inc'). I have two sites that have this identical problem, and both have UC and UC_Signup installed. I also have a site that has Signup installed as a stand-alone without UC_Signup, and on that one the confirmation email goes through without a problem.

Some points of clarification: I have signup configured such that it doesn't use the conventional Signup-enabled form that appears directly on the node. I set 'Do now show Signup Form' selected in the Signup admin interface, so instead, when a person chooses to purchase a Signup-enabled product from my client, the workflow is Product Page >> Shopping Cart >> Click 'Checkout' >> UC_Attendees (here you put attendee email address) >> Checkout page.

Thanks!
Nathan

ezra-g’s picture

Status: Fixed » Postponed (maintainer needs more info)

@nateeanes - This is the uc_signup queue, so you've already alerted the developer of uc_signup (me) ;).

Can you elaborate on the differences between the 2 uc_signup sites where this is and is not happening?

I think the most fool proof way to identify this bug will be to print the results of a debug_backtrace() into this issue.

visuaLatte’s picture

Status: Fixed » Postponed (maintainer needs more info)

@Ezra-G-- thanks for the quick response!

My two UC_Signup sites are configured the same way (UC, UC_Signup, Signup). BTW, their addresses are http://www.peaceburgh.net and http://www.pittsburghprep.com. Both have the same problem-- everything goes fine until the 'Success' page at the end of the Ubercart checkout, in which the error appears. But the transaction and signup go through without a hitch-- it's just that the confirmation email does not get sent.

My other site I mentioned, http://drupal.mysalesally.com, has no Ubercart and is just using Signup as a way to get clients to sign up for free events. In this one, the conventional Signup system is used-- the sign-up form is directly on the node itself, and everything works as it should.

Actually, I do have another unrelated issue: when using the Profile module (which allows users to add custom fields to their profiles-- like the name of their business, etc), there is an issue. The Profile module allows the admin to 'group' profile fields (e.g. 'Personal Information', 'Professional Information'), but when using UC_Signup, only the first fieldset gets displayed to the user. So the flow would be something like: Product >> Shopping Cart >> Hit 'Checkout' >> UC_Attendees >> Enter required personal info (or whatever the first Profile fieldset happens to be) >> Checkout Page >> Confirm >> Error: back to checkout page, some required profile fields are missing. I got around this by grouping all my profile fields into one fieldset, but this could still potentially be an issue.

Lastly-- forgive my ignorance, but how does one run debug_backtrace()?

Thanks for the help,
Nathan

ezra-g’s picture

Ah. The issue you describe with regard to only the first group of profile fields showing up is correct. Please file a separate issue for that -- I'd like to see it addressed :).

As far as the debug_backtrace() -- See http://php.net/manual/en/function.debug-backtrace.php for background information. Basically it lists all of the functions and their parameters that led to the current function being called. So, the technique here is to place debug_backtrace() in email.inc on the line before the error.

If you're not using the devel module's dprint_r() function, you'll want to wrap the print_r() in

 tags to format it's output correctly. So, you'll want to put something like the following in email.inc and have it generate the error:

$backtrace = '<pre>'. debug_backtrace() .'</pre>';

file_put_contents('/Users/You/uc_signup_549716.txt', $backtrace);

and then paste the output of that file in this issue. This would be really helpful to finding the cause of this issue. Thanks!

visuaLatte’s picture

@ezra-g - So this is strange. On one of my sites, several days ago (before finding this forum) I updated both UC_Signup and Signup to their newest versions, and tonight when adding debug_backtrace and trying to reproduce the error, it worked fine-- no error, and the confirmation emails came right through!

I wonder what was changed in the last versions of these modules that fixed the issue? I'll be updating my modules on the other Ubercart site tonight, and I'll report back on whether that site ends up with its problems fixed too.

Nathan

ezra-g’s picture

Thanks -- looking forward to hearing whether an updated/replaced signup.module was the solution here.

ezra-g’s picture

Status: Postponed (maintainer needs more info) » Fixed

No response for several weeks. Sounds like this was the solution.

bissupport’s picture

Status: Fixed » Active

hi
i am having the same issue and i am using all the latest module versions.

1. Signup 6.x-1.0-rc6
2. Signup Integration for Ubercart 6.x-1.0-beta4
3. set signup module not to show signup form on node
4. order places successfully but with the above error
5. Even after the error, I get the email, both to the attendee email (with default message from signup module) and admin email.

thanks for your help.

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

Can you do a debug_backtrace() as described in #18? http://drupal.org/node/549716#comment-2228440

ezra-g’s picture

Also, make sure user roles who are purchasing do not have the 'sign up for content' permission.

bissupport’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new149.46 KB

sorry took little time to get permissions on server working.

Yes, sign up for content permission is denied to both anonymous and authenticated users.
attached is the output from debugtrace.
thanks

ezra-g’s picture

Thanks.

On first glance, this seems like it has to do with Signup's token values for the confirmation email -- If there is no form data then we get that foreach error. So, this might actually result in a patch to signup. I can't investigate more right now but hope to soon. You might try removing those tokens from the email and seeing if it resolves the issue.

Is it possible to format this more clearly either with

 tags around the variable in the print_r  or by using devel's dprint_r? It's kind of hard to read. Thanks!
bissupport’s picture

StatusFileSize
new472.78 KB

There is no token in the confirmation email. just default message "Enter your default confirmation email message here". I even tested with some tokens, same issue.

Attached the formatted text file. Hope this is ok. For the time, i am going to block confirmation emails and may be format ubercart checkout confirmation email with the class information.
thanks for looking into this.

ChurchTechGuy’s picture

I am also experiencing a similar issue as above except I have one small difference in my setup. I have Free Payment setup.
On paid (paypal) events I see no error message, but the event admin never receives a signup notification email. The person registering does receive their event signup email.
On free events I see the above described warning, the event admin receives a signup email notification with only the user name. The person registering receives their event signup email.

All my problems started when I added the uc_free_payment module, but disabling this module does not restore proper emailing.

Let me know if you need more details.

Drupal - 6.15
Ubercart - 6.x-2.2
Signup - 6.x-1.0-rc6
Signup for UC - 6.x-1.0-beta4
UC_free_order - 6.x-1.0-beta4
PayPal - 6.x-2.2

pdemarte’s picture

I'm experiencing the same issue. My setup is similar to ChurchTechGuy's setup except I'm in Drupal 6.16.

Despite the warning, the email messages do get sent to each person I sign up for an event, tokens and all work correctly-- however I still see the warning:

warning: Invalid argument supplied for foreach() in /www/.../sites/all/modules/signup/theme/email.inc on line 41.

This is a function called theme_signup_custom_data_email() and it expects an argument called $data.

When I var_dump this argument, the result is (for 2 signups):

array(0) {
}

array(0) {
}
 
string(6) "a:0:{}"

array(0) {
}

array(0) {
}

array(0) {
}

string(6) "a:0:{}"

array(0) {
}

I get the resulting confirmation message twice:


    * Your password and further instructions have been sent to your e-mail address.
    * Your password and further instructions have been sent to your e-mail address.

which I expected. Then I get the warning which we have all been posting.

My solution is to tell the function to only proceed with its for loop if $data exists.

When I implemented this, I now get e-mail from the system, and no error messages.

I don't know whether this is a good fix for anybody else, or just a lame hack, but it's working for me. I overrode that function in my theme's template.php file as the following:

/**
 * Override The Signup.module email.inc theme function so that if there is no $data, the error message will not be triggered
 * warning: Invalid argument supplied for foreach() in /www/secure/events/sites/all/modules/signup/theme/email.inc on line 41. 
 */
 
 function phptemplate_signup_custom_data_email($data) {
   $output = '';
   if($data && is_array($data)):
     // Loop through each first level element.
     foreach ($data as $key => $value) {
       if (is_array($value)) {
         // Element is nested, render it recursively.
         // Instead of the overhead of theme(), just call ourself directly.
         $output .= "\n\r". call_user_func(__FUNCTION__, $value) ."\n\r";
       }
       else {
         $output .= theme('signup_custom_data_field_text', $key, $value) ."\n\r";
       }
     }
   endif;
   return $output;
 }

I'm on a deadline and moving on... If anybody has a proper solution this, I'll give it a try, but for now I think the above simple fix will work for me.

agentrickard’s picture

Status: Active » Needs review
StatusFileSize
new1.11 KB

I was able to replicate this error using out-of-the-box configurations of signup and uc_signup. It looks to be a simple data format issue.

Since uc_singup calls the mail function, I put the burden on this module to make sure that $signup->form_data is an array and not a serialized string. Since that value is immediately destroyed after the function is called, there is no harm in this transformation.

This patch also fixed a possible (though user-initiated) error that occurs if the user hits the "BACK" button and resubmits a completed order. uc_signup_order no longer assumes that the order contains products.

See duplicate issue #684920: PHP Error in forwarding signup notification email for more background on the array / serialization issue.

[EDIT]: Worth noting that I also started experiencing this after installing uc_free_order. Though the problem may have existed beforehand.

stenjo’s picture

Confirming that patch in #30 works on my install using Head of uc_signup and 6.x-1.0-rc6 of Signup module.
No error on fulfilling the order.

rryyaann_19’s picture

confirming this patch worked for me - using uc_signup-6.x-1.0-beta6 and signup-6.x-1.0.

Thanks a bunch! (I am relative new to this and the patch didn't take when I tried to apply, hence I changed the code myself, based on what was in the patch.... something about a missing unified diff in the header??)

agentrickard’s picture

That's probably because it is a patch against SVN and needs a re-roll to comply with http://drupal.org/patch/create

daniel-san’s picture

I was getting the same error as described above:
"warning: Invalid argument supplied for foreach() in C:\apache\htdocs\sites\cvcue.org\modules\signup\theme\email.inc on line 41."

I would get this error while manually updating the payment tab of an order. Added a customers payment and the type of payment and upon clicking 'Enter' I would receive the error.

Modules versions:
signup 6.x-1.0
uc_signup-6.x-1.0-beta6

Steps to try patch:

  1. I upgraded to uc_signup 6.x-1.x-dev
  2. Attempted same payment process and still received the error
  3. Applied the patch in #30
  4. Attempted same payment process and did NOT receive the error

Appears to be successful patch.

Thanks so much for working on this.

Dan

beifler’s picture

Subscribing - any update on when this is getting into dev?

benjf’s picture

I am seeing the same error - using ubercart-6.x-2.x-dev (July 8) with uc_signup-6.x-1.0-rc2 and this patch.

My signups are created properly, and email notifications are also being sent (I do not know what, if anything, is *not* happening properly). The error does not appear on-screen to users, just in the log. It seems to happen on every signup - single or multiple, anon or auth.

 Type: php
 User: Anonymous
 Location: http://mysite.com/uc_paypal/ipn/<order_number>
 Referrer: 
 Message: Invalid argument supplied for foreach() in /var/www/staging/sites/all/modules/signup/theme/email.inc on line 41.

At this point, I think the patch in comment #30 above is outdated and needs to be re-rolled. Any thoughts? Is the bottom portion still relevant?

ezra-g’s picture

Title: Error upon successfully signing up for an event (with Ubercart integration) » Errors when signup includes $signup->form_data
Category: support » bug
Status: Needs review » Fixed

I'm not able to reproduce this error with a default uc_signup/signup configuration, probably because that configuration never stores anything in $signup->form_data.

However, I recognize that some folks may still wish to store data in that column when using uc_signup.

I re-rolled the patch from #30, removed the hunk unrelated to the $signup->form_data issue, updated the code comment and committed. Thanks!

http://drupalcode.org/project/uc_signup.git/commit/dceadd8

Status: Fixed » Closed (fixed)

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