WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000240WeBidEmailpublic2011-03-09 13:092016-04-25 14:19
Assigned Torenlok 
Priority@0@SeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version1.0.1 
Target Version1.2.0Fixed in Version1.2.0 
Summary0000240: Undefined variable: winner_array in cron.php - winner emails not sent
DescriptionWhen an auction ends and there is a winner, the "you win" email is not being sent to the winner/buyer. I've tracked the problem down to the section of cron.php where endauction_youwin, endauction_winner and endauction_nowinner emails are generated. endauction_winner and endauction_nowinner work fine. endauction_youwin never even gets a chance to work because the array winner_array is not getting defined. The endauction_youwin section first runs through:

[FONT="Courier New"]if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)


but because $winner_array is undefined it never gets through there.

For testing purposes, I changed the above line to:

[FONT="Courier New"]if (2>1)[/FONT]

to ensure that we would get through that if statement. When we do get through that if statement then we get an error in the error log saying that winner_array is an undefined variable.

Though I dabble in lots of technical stuff and programming languages, I'm not fluent in this particular stuff so I don't know how to fix or further test this winner_array problem. Any ideas?

Thanks in advance!

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
Box Lot (reporter)
2011-03-09 15:45
edited on: 2011-03-09 15:49

Can't replicate.

With a standard auction the winner does receive an email. However, the sellers payment details (S_PAYMENT) are missing from the email.

I used html format though that shouldn't make a difference. Report back if it does for some reason.

I see the payment details issue is because it is never set anywhere though there is a database field in the table. I would have to give it some thought what should be sent directly to the buyer if anything. Address, for example, might be different from mailing address and/or seller might not accept mailed payments so sharing the address is out of line.
pamotos (reporter)
2011-03-09 17:06
edited on: 1970-01-01 00:00

i dont know if its the right place to post, but the endauction_winner email is not working for me... buyer receives email, seller doesnt.
dkmullen (reporter)
2011-03-10 01:51
edited on: 2011-03-10 01:53

Box Lot,

Here are all the references to winner_array in my cron.php. Please let me know if they're the same as yours. As I said, by the time cron.php gets down to the isset and is_array and count bits, winner_array is undefined so it never gets through that if statement and doesn't have the info to send the winner's email.

[FONT="Courier New"] $winner_array = array();
        $Winner = mysql_fetch_assoc($res_n);

        $winner_array[] = $Winner; // set array ready for emails

        if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)
            for ($i = 0, $count = count($winner_array); $i < $count; $i++)
                // Send mail to the buyer
                $Winner = $winner_array[$i];[/FONT]
Box Lot (reporter)
2011-03-10 02:08
edited on: 1970-01-01 00:00

All the references or a section? Line numbers?

Not sure what this is but if it is a section it is not in my cron.php.

My cron.php is 1.0.0.
dkmullen (reporter)
2011-03-10 02:32
edited on: 2011-03-10 02:33

These are just the individual lines that have winner_array in them. I've shown where $winner_array is first initialized, then were $winner_array[] is populated with $Winner (and I included what $Winner was initialized with). And then there's the part of the If statement that actually does the sending of the youwin email to the winner.

Here it is again with line numbers. Note that doing a search for 'winner_array' is a better way to find these because the line numbers in my file might be different from in yours. My cron.php is from a clean installation of 1.0.1:

[FONT="Courier New"]158 $winner_array = array();

183 $Winner = mysql_fetch_assoc($res_n);

189 $winner_array[] = $Winner; // set array ready for emails

295 if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)
296 {
297 for ($i = 0, $count = count($winner_array); $i < $count; $i++)
298 {
299 // Send mail to the buyer
300 $Winner = $winner_array[$i];[/FONT]
dkmullen (reporter)
2011-03-10 02:37
edited on: 1970-01-01 00:00

Here is my entire cron.php file. Note that I've made a couple of fixes in this file (sql syntax issues). Those fixes are notated with a comment line that has my initials, DKM.
dkmullen (reporter)
2011-03-10 02:38
edited on: 2011-03-10 02:39

cron.php as a text file (so it could upload)

edit: My bad! I thought I had to post a message while uploading a file...
pamotos (reporter)
2011-03-10 03:19
edited on: 1970-01-01 00:00

if i use buy now only does the seller receive an email?
dkmullen (reporter)
2011-03-10 03:29
edited on: 1970-01-01 00:00

pamotos wrote

if i use buy now only does the seller receive an email?

I don't know off-hand. I would assume the seller would receive an email no matter what way his/her item was sold. This discussion centers on defining the variable/array "winner_array" in cron.php. You might want to do some testing yourself or do some searches on the forum, maybe especially the General Support forum.
dkmullen (reporter)
2011-03-17 01:47
edited on: 1970-01-01 00:00

My site is live now. It is a single-seller site (a non-profit) so I can simply manually send out emails to the winners as auctions end. This isn't, however, a reasonable solution for the long run. Can anyone me diagnose this problem? What reasons could there be that winner_array isn't getting defined?

Thanks to all!

P.S. The site is here: http://penniesforchange.net/auctions/" [^" title="]]http://penniesforchange.net/auctions/[/URL] [^]

- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 242
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2011-03-09 13:09
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2011-03-17 01:47
2016-04-24 14:16 renlok Target Version => 1.2.0
2016-04-25 14:19 renlok Status new => resolved
2016-04-25 14:19 renlok Fixed in Version => 1.2.0
2016-04-25 14:19 renlok Resolution open => fixed
2016-04-25 14:19 renlok Assigned To => renlok

Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker