Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomArg indexing into Personalizations #819

Closed
haywiremk opened this issue Apr 1, 2019 · 1 comment · Fixed by #952
Closed

CustomArg indexing into Personalizations #819

haywiremk opened this issue Apr 1, 2019 · 1 comment · Fixed by #952
Labels
difficulty: unknown or n/a fix is unknown in difficulty type: bug bug in the library

Comments

@haywiremk
Copy link

haywiremk commented Apr 1, 2019

Issue Summary

The following code in Mail.php in the function addCustomArg() accepts a personalizationIndex. However by the logic below if this [0] personalization exist there is no way to index past and add a customArg. Seem like should remove the first if statement and set the function variable default to 0 instead of null or is there some reason for this? Seems like a bug prevent me from updating personalizaitons.

starting Line 847 in Mail.php

            if ($this->personalization[0] != null) {
                $this->personalization[0]->addCustomArg($custom_arg);
            } else if ($this->personalization[$personalizationIndex] != null) {
                $this->personalization[$personalizationIndex]->addCustomArg(
                    $custom_arg
                );
            } else {
                $personalization = new Personalization();
                $personalization->addCustomArg($custom_arg);
                if (($personalizationIndex != 0)
                    && ($this->getPersonalizationCount() <= $personalizationIndex)
                ) {
                    $this->personalization[$personalizationIndex] = $personalization;
                } else {
                    $this->addPersonalization($personalization);
                }
            }

Technical details:

*loaded from composer
*"name": "sendgrid/sendgrid",
*"version": "7.2.1",

@thinkingserious
Copy link
Contributor

Hello @haywiremk,

Thanks for highlighting this error. We will investigate further. In the mean time, I will label the issue appropriately and add to our backlog.

Thanks!

With Best Regards,

Elmer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: unknown or n/a fix is unknown in difficulty type: bug bug in the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants