Giter VIP home page Giter VIP logo

Comments (19)

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

I forgot to say, I have this code working in other dev orgs and tests run fine, this is when I try to deploy to a new dev org, is there something I need to update/change with new Salesforce releases?

from twilio-salesforce.

hhai avatar hhai commented on August 10, 2024

https://help.salesforce.com/apex/HTViewSolution?id=000213516&language=en_US

If you have accepted the critical update on those orgs for "Predictable Iteration Order for Apex Unordered Collections", then the test classes will fail because the order no longer matches what is returned. In these cases I would re-order the parameters in the MAP in most of the cases, until we can patch the code.

This is re-ordered to match the URL.

        map<string,string> params=new map<string,string>();
        params.put('AreaCode','510');
        params.put('Contains','51034*****');

from twilio-salesforce.

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

Thanks for your response it helped us alot, we followed your steps and the errors are gone

from twilio-salesforce.

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

I need to add that we had to add a validation for the orgs that hasn't accepted the update yet in order to work in both scenarios.

static testMethod void testGenerateParamString() {
    Boolean firstKey = true;
    Boolean isOrdered = false;
    Map<String, String> ordMap = new Map<String, String>{'a' => 'b', 'c' => 'd'};
    for(String key: ordMap.keySet()){
        if(ordMap.get(key) == 'b' && firstKey){ isOrdered = true; }
        firstKey = false;
    }

    if(isOrdered){
                    //Update accepted
        System.assertEquals('', generateParamString(new Map<String,String>()));
        System.assertEquals('a=b', generateParamString(new Map<String,String> {'a'=>'b'} ));
        System.assertEquals('foo=bar&cat=dog', generateParamString(new Map<String,String> {'foo'=>'bar', 'cat' => 'dog'} ));
        System.assertEquals('a=b&c=d&e=f', generateParamString(new Map<String,String> {'a'=>'b', 'c'=>'d', 'e'=>'f' } ));
        System.assertEquals('split+key1=split+val1&split+key2=split+val2', generateParamString(new Map<String,String> {'split key1'=>'split val1', 'split key2'=>'split val2'} ));
    }else{
                    //Update not accepted
        System.assertEquals('', generateParamString(new Map<String,String>()));
        System.assertEquals('a=b', generateParamString(new Map<String,String> {'a'=>'b'} ));
        System.assertEquals('cat=dog&foo=bar', generateParamString(new Map<String,String> {'foo'=>'bar', 'cat' => 'dog'} ));
        System.assertEquals('e=f&c=d&a=b', generateParamString(new Map<String,String> {'a'=>'b', 'c'=>'d', 'e'=>'f' } ));
        System.assertEquals('split+key2=split+val2&split+key1=split+val1', generateParamString(new Map<String,String> {'split key1'=>'split val1', 'split key2'=>'split val2'} ));
    }
}

from twilio-salesforce.

dschach avatar dschach commented on August 10, 2024

Please reopen this and change

if(ordMap.get(key) == 'b' && firstKey)isOrdered = true;

to

if(ordMap.get(key) == 'b' && firstKey){ isOrdered = true; }

This is the error that created a major security hole in OSX, and best-practice is to use curly brackets for every if statement, even on one line.

from twilio-salesforce.

skimbrel avatar skimbrel commented on August 10, 2024

I'd be happy to review a pull request for that :)

from twilio-salesforce.

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

re-opened issue and updated the comment and our code, thanks for the heads up

from twilio-salesforce.

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

I have sent the request

from twilio-salesforce.

dschach avatar dschach commented on August 10, 2024

Thank you. Apologies for asking someone else to make the change (faux pas, I know) but I wasn't at a machine that would let me do it myself. Go team!

from twilio-salesforce.

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

no prob, I just haven't had enough time to figure out how to remove whitespacing and indentation :P

from twilio-salesforce.

Harishgudipudi avatar Harishgudipudi commented on August 10, 2024

Hi,

I'm new to this twilio stuff but when I'm trying to deploy I'm getting the same errors in the salesforce production and also we have the update our org with critical updates.

Can you pls let me know on which class I have to update these Lines:

map<string,string> params=new map<string,string>();
params.put('AreaCode','510');
params.put('Contains','51034*****');

from twilio-salesforce.

Harishgudipudi avatar Harishgudipudi commented on August 10, 2024

Here is the test class failures:
twilio errors

from twilio-salesforce.

EmilioGalicia avatar EmilioGalicia commented on August 10, 2024

Hi,

You need to modify both files: Twilio_TestApplication and Twilio_TestPhoneNumbers

from twilio-salesforce.

kushkella avatar kushkella commented on August 10, 2024

Is it possible if we can get an updated managed package with this bug fix?

from twilio-salesforce.

hhai avatar hhai commented on August 10, 2024

We currently aren't releasing managed packages for salesforce.

from twilio-salesforce.

kushkella avatar kushkella commented on August 10, 2024

Sorry, I meant unmanaged package. Is v4.0.0 with this bug fix?

from twilio-salesforce.

hhai avatar hhai commented on August 10, 2024

The latest version has many updates in it, including support for some of our new APIs, and re-ordering the test data expected to the Salesforce Unordered Lists patch which is auto activated on 6/5 by salesforce. However, it also has some restructuring of classes so if you have already installed and are leveraging an older version I would advise you to update the test class yourself versus using v4.0.

from twilio-salesforce.

saamabbas avatar saamabbas commented on August 10, 2024

To Fix the issue quickly:

  1. Re - Order Map values in Twilio_TestApplication class near line no. 130 and 219 as given below:
    params.put('VoiceMethod','POST');
    params.put('FriendlyName','Testapp1');

  2. Re - Order Map values in Twilio_TestPhoneNumbers class near line no. 264 as given below:
    params.put('AreaCode','510');
    params.put('Contains','51034*****');

  3. Comment the 5 line code from line no. 271 to 275 in TwilioCapability class and all the error will be gone.

from twilio-salesforce.

crashdebit avatar crashdebit commented on August 10, 2024

@saamabbas very clear on the directions listed above, wanted to comment that this fix worked perfectly.

from twilio-salesforce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.