I have been working on this problem for three days now and I'm ready to jump off of a bridge. Any help is much appreciated. I will include as many details as I can. I have tried using trace to debug it with no success.

I am trying to use a webform to process a simple credit card transaction that interfaces with First Data's Linkpoint gateway. Once it's tested and working, I will implement the secure pages module to make it secure.

I am using Drupal 6.10 with Webforms 6.x-2.6 . The code for all involved php files is included as an appendix to this post ajd the files are also attached.

In the additional validation section, I am calling a php include called preauthorization.php. This piece of code runs a preauth transaction with First Data and returns the results. If there's a problem it uses form_set_error. This piece of code works if there is no code in additional processing section.

In the additional processing section, I am trying to make several things happen:

- Process the credit card using my process_periodic_billing.php include file (this works when there is nothing in the additional validation section)
- Deploy a customer application using my deploy.php include file (this also works alone, without anything in the additional validation section)
- Send an email to the new customer using my deployment_mail.php include file (this also works alone, without anything in the additional validation section)

For the purposes of testing the credit card piece, I have commented out everything in the additional processing section, except for process_periodic_billing.php.

THE PROBLEM

The white screen of death appears when I have:

- the preauthorization.php as an include in the additional validation section

and

- the process_periodic_billing.php as an include in the additional processing section

and

- when the preauthorization.php returns approved which would activate the additional processing

If I comment out process_periodic_billing.php in the additional processing section, then preauthorization.php works fine alone and you are redirected to the thank you page.

If I comment out preauthorization.php in the additional processing section, then process_periodic_billing.php works fine alone and you are redirected to the thank you page.

I have tried other ways of doing this, but to no avail. The one constant is that it seems that activating ANY code in the additional processing section while preauthorization.php is included in the additional validation section causes the white screen of death.

This is from a tail -f of trace.log when receiving the white screen of death:

p' => 'Place order and create my aimtheoryCRM site')
#89fe6aec T+0.016001 [DEBUG ] $_FILES = array()
#89fe6aec T+0.016001 [DEBUG ] $_SESSION = array('node_overview_filter' => array())
#89fe6aec T+0.064004 [HOOK ] hook_forms: webform, node, search, user, simplenews, uc_product, views_bulk_operations
#89fe6aec T+1.208069 [RESPNSE] 2009-05-21 08:35:29.148944 200 OK

I noticed that this is a little different from what a successful page load looks like:

#8d2e37c5 T+0.012001 [DEBUG ] $_GET = array('q' => 'imagepicker')
#8d2e37c5 T+0.012001 [DEBUG ] $_SESSION = array('node_overview_filter' => array())
#8d2e37c5 T+0.068004 [DEBUG ] drupal_set_message() = NULL
#8d2e37c5 T+0.068004 [DEBUG ] drupal_set_header() = array('Content-Type: text/html; charset=utf-8')
#8d2e37c5 T+0.068004 [RESPNSE] 2009-05-21 08:36:18.995785 200 OK

Notice that the drupal_set messages are missing.

PLEASE, any help you can offer will be much appreciated!!!!

APPENDIX

Please see the image attachment for a screenshot of the advanced settings section.

preauthorize.php


include "/var/www/aimtheory.com/signup/lphp.php";
$mylphp=new lphp;

# constants

$subscription_type 	= $form_values['submitted_tree']['subscription_type'];
	
$myorder["host"]    		= "secure.linkpt.net";
$myorder["port"]     		= "1129";
# Change this to the name and location of your certificate file 
$myorder["keyfile"]  		= "/var/www/aimtheory.com/signup/1236331.pem"; 
$myorder["configfile"] 	= "1236331";        # Change this to your store number 

//$_POST["verbose"] = true;

# form data
$myorder["cardnumber"]  	= $form_values['submitted_tree']['billing_information']['card_number'];
$myorder["cardexpmonth"]  = $form_values['submitted_tree']['billing_information']['expires_on_month'];
$myorder["cardexpyear"]   = $form_values['submitted_tree']['billing_information']['year_expires'];
if ($subscription_type == "basic") {
	$myorder["chargetotal"]   = 29;
} elseif ($subscription_type == "plus") {
	$myorder["chargetotal"]   = 49;
} elseif ($subscription_type == "premium") {
	$myorder["chargetotal"]   = 99;
}

$myorder["ordertype"]     = "Preauth";

//$myorder["debugging"]		= "true";

$myorder["result"]     	= "Good";

# Send transaction. Use one of two possible methods  #
//	$result = $mylphp->process($myorder);       # use shared library model
$result = $mylphp->curl_process($myorder);  # use curl methods

if ($result["r_approved"] != "APPROVED")    // transaction failed, print the reason
{
	//$card_err_msg = "Status:  $result[r_approved]<br>\n";
	//$card_err_msg = $card_err_msg . "Error:  $result[r_error]<br><br>\n";
	$card_err_msg = "Oops! We're sorry, there seems to be a problem with this credit card number. Please try submitting it again, or try using a different card.";	
	
	form_set_error('submitted][card_number', t($card_err_msg));
	//exit()
	//echo $card_err_msg;
	
	//print "Status:  $result[r_approved]<br>\n";
	//print "Error:  $result[r_error]<br><br>\n";
}
else	// success
{		
	//print "Status: $result[r_approved]<br>\n";
	//print "Transaction Code: $result[r_code]<br><br>\n";
}

# if verbose output has been checked,
# print complete server response to a table
/*
if ($_POST["verbose"])
{
	echo "<table border=1>";

	while (list($key, $value) = each($result))
	{
		# print the returned hash 
		echo "<tr>";
		echo "<td>" . htmlspecialchars($key) . "</td>";
		echo "<td><b>" . htmlspecialchars($value) . "</b></td>";
		echo "</tr>";
	}	
		
	echo "</TABLE><br>\n";
}
*/

process_periodic_billing.php

	include "/var/www/aimtheory.com/signup/lphp.php";
	$mylphp2=new lphp;

	# constants

	$subscription_type 	= $form_values['submitted_tree']['subscription_type'];
		
	$myorder["host"]    		= "secure.linkpt.net";
	$myorder["port"]     		= "1129";
	# Change this to the name and location of your certificate file 
	$myorder["keyfile"]  		= "/var/www/aimtheory.com/signup/1236331.pem"; 
	$myorder["configfile"] 	= "1236331";        # Change this to your store number 

	//$_POST["verbose"] = true;

	# form data
	$myorder["cardnumber"]  	= $_GET['cnum']; //$form_values['submitted_tree']['billing_information']['card_number'];
	$myorder["cardexpmonth"]  = $_GET['cmonth']; //$form_values['submitted_tree']['billing_information']['expires_on_month'];
	$myorder["cardexpyear"]   = $_GET['cyear']; //$form_values['submitted_tree']['billing_information']['year_expires'];
	$myorder["chargetotal"]    = $_GET['total'];
	
	$myorder["ordertype"]     = "SALE";

	# recurring info
	$myorder["recurring"]		= "Yes";
	$myorder["action"]		= "SUBMIT";
	$myorder["installments"]	= 99;
	$myorder["threshold"]		= 3;
	$myorder["periodicity"]	= "m1";
	$myorder["startdate"]		= date("Ymd",mktime(0,0,0,date("m") ,date("d")+14,date("Y")));
	$myorder["result"]		= "Good";
	
	//$myorder["debugging"]="true";

  # Send transaction. Use one of two possible methods  #
//	$result = $mylphp->process($myorder);       # use shared library model
	$result = $mylphp2->curl_process($myorder);  # use curl methods

	if ($result["r_approved"] != "APPROVED")    // transaction failed, print the reason
	{
		//print "Status:  $result[r_approved]<br>\n";
		//print "Error:  $result[r_error]<br><br>\n";
	}
	else	// success
	{		
		//print "Status: $result[r_approved]<br>\n";
		//print "Transaction Code: $result[r_code]<br><br>\n";
		mail('ian.d.rossi@gmail.com', 'Process Success', 'The credit card was successfully process!');
	}

# if verbose output has been checked,
# print complete server response to a table
	/*
	if ($_POST["verbose"])
	{
		echo "<table border=1>";

		while (list($key, $value) = each($result))
		{
			# print the returned hash 
			echo "<tr>";
			echo "<td>" . htmlspecialchars($key) . "</td>";
			echo "<td><b>" . htmlspecialchars($value) . "</b></td>";
			echo "</tr>";
		}	
			
		echo "</TABLE><br>\n";
	}
	*/

lphp.php is required by the previous two scripts. Please find it attached. I didn't paste it here because it's huge.

THANKS!!!!

Ian D. Rossi

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Hi Ian, that's quite a write up! As I've been posting on many issues recently help with custom PHP code is outside the scope of support offered in the Webform issue queue (at least by maintainers). The best advice I have is that you enabled error_reporting in your php.ini file. This will make it so that instead of getting a WSOD, PHP will helpfully print out what caused the error instead. My guess is an out of memory error, but again without having error reporting turned on, it's hard to know where things went wrong.

ian.d.rossi’s picture

Hi quicksketch,

Thanks for your quick reply!

Yeah I know I included a lot of information, I just wanted to make sure that anybody that was able to spend their own time to take a look at it would have all of the information. I just thought a second set of eyes looking at the code could help.

I do have error_reporting set to E_ALL in the php.ini file and I have tested it with 256M of memory set as well with the same result.

I have tested this code externally by creating a stand-alone PHP file and placing both of these files in as includes and it works fine with both pieces of code being executed by the server. I just don't understand what it could be at this point.

It seems that if I include code in the additional validation section and then have ANY CODE AT ALL in the additional processing section, I get this error.

Could it be a bug?

Thanks again for your help!

Ian

quicksketch’s picture

Sorry I meant to say make sure "display_errors" is set to on, not "error_reporting". It'd be pretty unusually to get a completely white screen if errors are being displayed.

Something you might look out for is overwriting existing variables by using variables of the same name, some variables that would cause trouble if overwritten: $node, $submitted, $form_state, $form_values, etc. I'm not sure what all the potential variables are right there.

In general, I think you might be taking an inappropriate approach to what you're trying to accomplish. Anything that contains such a large section of code should never be stored in the database (it makes debugging nearly impossible). Instead you should write a custom module that modifies the behavior of the webform form by using hook_form_alter() and adding extra #validate or #submit properties. I recently outlined this same procedure in http://drupal.org/node/467504#comment-1611076

quicksketch’s picture

Status: Active » Closed (fixed)