PHP 中的分段错误错误,使用 SOAP 连接到 SalesForce

发布于 2024-10-17 23:48:05 字数 1918 浏览 2 评论 0原文

我正在使用 SalesForce PHP 工具包将我的软件 (PHP) 与 SalesForce 集成。

到目前为止,一切都很顺利,但是当我开始编写代码来调用convertLead()时,我收到了“分段错误”错误。

这是我正在运行的代码:

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));

就是这样。我遇到了分段错误。我尝试使用 StdClass 而不是键控数组,同样的事情。 SF 工具包中的 ConvertLead 方法非常简单,它只是将相同的方法调用到 SoapClient 实例中...

注意: 我从 CLI 运行此脚本,而不是通过 Apache。


更新:刚刚尝试用我的脚本运行“strace”。它的最后几行是:

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 +++

另外,如果它是相关的:

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

这也发生在我的开发机器(Windows)中,所以我怀疑它是加速器或类似的东西:

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

这可能是也可能不是特定于 SalesForce 的。可能不是,看起来像是 SOAP PHP 库中的一个错误。也许请求/响应已损坏,但我看不到它们,因为它们是 HTTPS。

我有什么想法可以诊断(或更重要的是解决)这个问题吗?

谢谢!
丹尼尔

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北音执念 2024-10-24 23:48:05

PHP Soap 扩展中存在一个错误(4 年后仍然存在)。它与它处理 WSDL 缓存的方式有关。使用 ini_set() 禁用缓存不起作用。您还需要关闭特定客户端实例的缓存。

return new SforceEnterpriseClient('../salesforce/enterprise.wsdl.xml', array(
    'cache_wsdl' => WSDL_CACHE_NONE
));

即使使用本机 PHP SoapClient 类也是如此。

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.

看海 2024-10-24 23:48:05

好吧,这并不能解决根本问题,但是,如果有人在 SalesForce 和 PHP 中遇到同样的问题...

尽管文档暗示了这一点,SendNotificationEmail 和 OverwriteLeadSource 字段是强制性的,您必须在调用中指定它们。

不这样做应该会给你一个很好的错误,而不是 SegFault,但仍然可以解决它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文