Segmentation Fault error in PHP, using SOAP to connect to SalesForce

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.


UPDATE: Just tried running "strace" with my script. The last lines of it are:

close(4)                                = 0
write(1, "Logged IN!", 10Logged IN!)              = 10
open("error_log", O_WRONLY|O_CREAT|O_APPEND, 0644) = 4
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Also, in case it's relevant:

php --version
PHP 5.2.13 (cli) (built: Jul 17 2010 22:01:13)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by ionCube Ltd., and
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

This also happens in my dev machine (Windows), so I doubt it's the Accelerators or anything like that:

php --version
PHP 5.2.13 (cli) (built: Feb 24 2010 14:37:44)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

This may or may not be specific to SalesForce. Probably not, seems like a bug in the SOAP PHP library. Maybe the request/response are broken, but I can't see those because they're HTTPS.

Any ideas how I can go about diagnosing (or more importantly, working around) this issue?

Thank!
Daniel


There is a bug (still after 4 years) 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.


Ok, this doesn't solve the underlying issue, but, in case someone got this same problem with SalesForce and PHP...

Despite what the documentation implies, fields SendNotificationEmail and OverwriteLeadSource ARE MANDATORY, you MUST specify them in the call.

Not doing so should give you a nice error, not a SegFault, but still, that solves it.

链接地址: http://www.djcxy.com/p/63962.html

上一篇: PHP / Apache崩溃脚本(分段错误(11)

下一篇: Segmentation PHP中的错误错误,使用SOAP连接到SalesForce