• InstaRespuesta
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I'm not the resident PHP developer, but our resource in-house has had the following issue:

 

We tried to upgrade our system from the Salesforce Partner PHP toolkit v11 to the latest v20.

 

However, we started experiencing some very strange results as soon as we switched to the new libraries. To confirm, we kept all the old working queries as is, so the issue is not with how we query or manipulate the data. The issue is that what Salesforce returns using the v20 toolkit is radically different and looks corrupt.  

 

We can switch the libraries back and forward (old and new) to produce the results below.

 

V11 returned the Object like:

 

SObject Object
(
    [type] => PricebookEntry
    [fields] => SimpleXMLElement Object
        (
            [UnitPrice] => 8.04
            [CurrencyIsoCode] => GBP
        )
    [sobjects] => Array
        (
            [0] => SObject Object
                (
                    [type] => Product2
                    [fields] => SimpleXMLElement Object
                        (
                            [Carbon_Database_id__c] => 12.0
                            [Id] => 01t20000000iTW4AAM
                            [Name] => Big River Salmon Creek Forestry
                            [Family] => Carbon Instruments
                            [IsActive] => true
                        )

                    [Id] => 01t20000000iTW4AAM
                )
            [1] => SObject Object
                (
                    [type] => Pricebook2
                    [fields] => SimpleXMLElement Object
                        (
                            [Name] => 3) >= 5
                            [IsActive] => true
                        )
                )
        )
)

 

V20 returned the Object like:

 

stdClass Object
(
    [type] => PricebookEntry
    [Id] => 
    [any] => Array
        (
            [Product2] => stdClass Object
                (
                    [type] => Product2
                    [Id] => Array
                        (
                            [0] => 01t20000000iTW4AAM
                            [1] => 01t20000000iTW4AAM
                        )
                    [any] => <sf:Carbon_Database_id__c>12.0</sf:Carbon_Database_id__c><sf:Id>01t20000000iTW4AAM</sf:Id><sf:Name>Big River Salmon Creek Forestry</sf:Name><sf:Family>Carbon Instruments</sf:Family><sf:IsActive>true</sf:IsActive>
                )
            [Pricebook2] => stdClass Object
                (
                    [type] => Pricebook2
                    [Id] => 
                    [any] => <sf:Name>3) &gt;= 5
                )
            [0] => <sf:UnitPrice>8.04</sf:UnitPrice><sf:CurrencyIsoCode>GBP</sf:CurrencyIsoCode>
        )
)

 

Notice how unstructured and a mess this is, it has jumbled all the relevant data into these <sf: tags.

 

This issue occurred on the first Query, here are the bones of that part:

 

$response = $mySforceConnection->query($query);
$queryResult = new QueryResult($response);

foreach ($queryResult->records as $record) {
print_r($record);

 

Does anybody know why the change from Version 13 to version 20 might have caused this change?