From:             mike at silverorange dot com
Operating system: Irrelevant
PHP version:      5.2.5
PHP Bug Type:     SOAP related
Bug description:  SOAP extension object decoding bug

Description:
------------
When decoding a SOAP response into zvals, the decoder sometimes gets
confused decoding objects. We noticed this using the PayPal Express
Checkout SOAP API.

For one request type, the returned XML was correct; however, the decoded
PHP objects that were returned were incorrect. One value that should have
been a string was a string reference and an object that should have been an
object was as string.

Upon further investigation, we found other users had been experiencing
this specific problem using PayPal's SOAP API with PHP since PHP 5.2.2.

After a bit of CVS research, it seems the bug was introduced in
1.103.2.21.2.27 in soap_encoding.c to fix bug #37013.

The patch at
http://labs.silverorange.com/files/php-patches/soap-object-reference-bug-20080501.patch
works around the bug for our needs, but it does not fix the underlying
problem and probably reintroduces #37013.

Reproduce code:
---------------
I can't provide a runnable test case unless you have PayPal developer API
credentials. If so, you can run the unit tests in the package at:

http://labs.silverorange.com/files/Payment_PayPal_Soap/Payment_PayPal_Soap-0.0.4.tgz

The second test will fail if the bug is present and pass if the bug is
fixed.

I've attached a var_dump of broken an working SOAP results to illustrate
the broken 'PayerInfo' element parsing.

Expected result:
----------------
object(stdClass)#114 (6) {
  ["Timestamp"]=>
  string(20) "2008-05-01T17:41:45Z"
  ["Ack"]=>
  string(7) "Success"
  ["CorrelationID"]=>
  string(13) "9d6aa8c0309df"
  ["Version"]=>
  string(8) "1.000000"
  ["Build"]=>
  string(6) "548868"
  ["GetExpressCheckoutDetailsResponseDetails"]=>
  object(stdClass)#113 (2) {
    ["Token"]=>
    string(20) "EC-6AU15743MX2745842"
    ["PayerInfo"]=>
    object(stdClass)#112 (6) {
      ["Payer"]=>
      string(0) ""
      ["PayerID"]=>
      string(0) ""
      ["PayerStatus"]=>
      string(10) "unverified"
      ["PayerName"]=>
      object(stdClass)#110 (5) {
        ["Salutation"]=>
        string(0) ""
        ["FirstName"]=>
        string(0) ""
        ["MiddleName"]=>
        string(0) ""
        ["LastName"]=>
        string(0) ""
        ["Suffix"]=>
        string(0) ""
      }
      ["PayerBusiness"]=>
      string(0) ""
      ["Address"]=>
      object(stdClass)#111 (9) {
        ["Name"]=>
        string(0) ""
        ["Street1"]=>
        string(0) ""
        ["Street2"]=>
        string(0) ""
        ["CityName"]=>
        string(0) ""
        ["StateOrProvince"]=>
        string(0) ""
        ["CountryName"]=>
        string(0) ""
        ["PostalCode"]=>
        string(0) ""
        ["AddressOwner"]=>
        string(6) "PayPal"
        ["AddressStatus"]=>
        string(4) "None"
      }
    }
  }
}

Actual result:
--------------
object(stdClass)#114 (6) {
  ["Timestamp"]=>
  string(20) "2008-05-01T17:56:31Z"
  ["Ack"]=>
  string(7) "Success"
  ["CorrelationID"]=>
  string(13) "233fdab3c0758"
  ["Version"]=>
  string(8) "1.000000"
  ["Build"]=>
  string(6) "548868"
  ["GetExpressCheckoutDetailsResponseDetails"]=>
  object(stdClass)#113 (2) {
    ["Token"]=>
    &string(20) "EC-8JA130819B922424F"
    ["PayerInfo"]=>
    string(20) "EC-8JA130819B922424F"
  }
}

-- 
Edit bug report at http://bugs.php.net/?id=44882&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44882&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44882&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44882&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44882&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44882&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44882&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44882&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44882&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44882&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44882&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44882&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44882&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44882&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44882&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44882&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44882&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44882&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44882&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44882&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44882&r=mysqlcfg

Reply via email to