2006/4/28, Dave Goodchild <buddhamagnet@xxxxxxxxx>:
Hi all - I am attempting to solve some maddening behaviour that has me totally stumped and before I take a blade to my throat I thought I would pick the brains of the group/hive/gang. I am working on a viral marketing application that uses multipart emails to notify entrants of their progress in the 'game'. I have a demo version which works fine, and the current rebranded version was also fine until the client asked for some changes then POWWWWW! I will try and define the issue as simply as I can. I am passing 11 arguments to a function called sendSantaMail (don't ask) and as a sanity check I have called mail() to let me know the values just before they are passed in to the function. I get this result:
sendSantaMail???? That's just not a *declarative* way of naming a function. Then, 11 arguments???? Errr, passing an associative array with the email parameters wouldn't have been a cleaner and better option? "Values to be passed to sendSantaMail:
Friend Name: Treyt Friend Email: wonder@xxxxxxx Sender Name: Bull Sykes Sender Email: chancer@xxxxxxxxx Prize ID: 1 Nominator ID: 2555004452133557e4d Nominee ID: 851355445213355cc6f Chain ID: CHAIN824452133561a8d" - this is all good and correct. I also call mail from the receiving function to check the actual values received by the function and I get this: "Values sent into sendSantaMail function: Friend Name: chancer@xxxxxxx Friend Email: Look what you may have won! Sender Name: 8 Use of undefined constant prize - assumed 'prize' Sender Email: 158 Sender Email: /home/friend/public_html/process1.php Prize: 1 Subject: 158 Nominator ID: 33238744520f5235b85 Nominee ID: 96658244520f524bb19 Chain ID: CHAIN84644520f525a56f" What is happening? I have checked the order of values being passed in and the function prototype and they match in the correct order, there are no default values. I have been trying to solve this for two days and am particularly concerned that somewhere along the way the sender email value becomes the script name.
One idea, you messed up somewhere. Use debug_print_backtrace() on the function to get a dump of function call stack. Use it with an if to catch the moment where the wrong values appear. The first entry of the backtrace should point the file and line where the function was called. If you're using php4 you'll have to use var_dump(debug_backtrace()) instead of debug_print_backtrace(). Also check the error "Use of undefined constant prize - assumed 'prize'". Please tell me your are not doing something like this: $arr[prize] Any ideas on this black Friday?
-- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!