Home » Web Services » SOAP » Bug #7156
segfault in SOAP_Value::serialize()
Details
| Submitted | 2006-03-18 23:53 UTC |
|---|---|
| From | jhannus at php dot net |
| Assigned | yunosh |
| Status | Bogus |
| Package | SOAP |
| PHP Version | 5.1.2 |
| OS | Centos 4.2 |
| Roadmaps | (Not assigned) |
Comments
[2006-03-18 23:53 UTC] jhannus at php dot net
Description:
------------
php segaults when I return a SOAP_Fault in any of my methods. I've traced it down to SOAP_Value::serialize(), which is really in SOAP_Base::_serializeValue().
around line #478 in SOAP/Base.php, if a value contains other SOAP_Values it recurses, and the segfault happens under there somewhere.
if (is_a($vars[$k], 'SOAP_Value')) {
$xmlout_value .= $vars[$k]->serialize($this);
}
The SOAP_Fault has each attribute as a SOAP_Value so when it recurses on the first one it barfs somewhere.
i've also tried this on windows with 5.1.1 and same thing. i can help debug some more if you need.
-justin
Test script:
---------------
class SOAP_Foo_Server
{
var $__dispatch_map = array();
function SOAP_Foo_Server() {
$this->__dispatch_map['doFoo'] = array (
'in' => array('bar' => 'string'),
'out' => array('value' => 'boolean')
);
}
function doFoo($bar) {
return new SOAP_Fault('whoops!', 'Server');
}
}
[2006-03-19 02:24 UTC] jhannus at php dot net
i put it down for a little while and came back to it and found that the segfault happens in the serialization of the backtrace and userinfo properties of the SOAP_Fault.
comment out those 2 lines and the segfault goes away:
Fault.php #73
if (isset($this->backtrace)) {
//$params[] =& new SOAP_Value('detail', 'string', $this->backtrace);
} else {
//$params[] =& new SOAP_Value('detail', 'string', $this->userinfo);
}
hope this helps,
-justin
[2006-03-19 19:13 UTC] jhannus at php dot net
>Backtraces almost always have recursive structures if used with
>sufficient complex objects.
nevertheless, you shouldn't have to set a property to avoid segfaults when coding with php. maybe the backtrace should be turned off by default? either that or the code should correct itself in that condition.
>The serialize methods runs into
>an endless loop as a result.
again, a condition that should be met...
// would you do this....
while (true);
// and supply this for the fix?
$fix = &PEAR::getStaticProperty('My_Foo', 'fix_my_bugs');
$fix = true;
:)
when a user trys a PEAR package out and follows even the simplest of examples... a segfault might just turn them off to the package alltogether. i wouldn't consider the bug "Bogus" but in this case i guess its better than "Closed".
IMHO: in terms of SOAP and SOAP Faults i dont see the real point of having a backtrace and userinfo in there by default anyway. its just a pear and php thing. aside from the security thing other clients may not even look for it. yeah, nice for debugging but when using a package/library you should have to turn debugging on, not off.
>See request 6936 for instructions how to
>disable backtraces.
thanks, i found that documentation last night.
-justin