0 votes
1 view
in Salesforce by (10.6k points)
edited by

I'm integrating my software (PHP) with SalesForce, using the SalesForce PHP Toolkit.

So far, everything's worked great, but when I started writing the code to call convertLead(), I got a "Segmentation Fault" error.

This is the code I'm running:

require_once('../salesforce/SforceEnterpriseClient.php');

ini_set('soap.wsdl_cache_enabled', 0);

$SForce = new SforceEnterpriseClient();

$result = $SForce->createConnection('../salesforce/enterprise.wsdl.xml');

$result = $SForce->login('user', 'pass+token');

    echo "Logged In!";

$data = array(

    'convertedStatus' => 'Converted',

    'leadId' => '00QC000000mDcmJMAS'

);

$result = $SForce->convertLead(array($data));

That's it. And I'm getting a Segmentation Fault. I tried using StdClass instead of a keyed array, same thing. The convertLead method in the SF toolkit is really simple, it just calls the same method into a SoapClient instance...

NOTE: I'm running this script from the CLI, not through Apache.

1 Answer

0 votes
by (26.3k points)
edited by

There is a bug in the PHP soap extension. It has to do with how it handles WSDL caching. Disabling caching with ini_set() does not work. You also need to turn off caching for your particular client instance.

return new SforceEnterpriseClient('../salesforce/enterprise.wsdl.xml', array(

    'cache_wsdl' => WSDL_CACHE_NONE

));

This is true even when using the native PHP SoapClient class.

...