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

Bug in sendgrid client library #131

Closed
hhminh opened this issue Mar 10, 2015 · 10 comments
Closed

Bug in sendgrid client library #131

hhminh opened this issue Mar 10, 2015 · 10 comments

Comments

@hhminh
Copy link

hhminh commented Mar 10, 2015

It appears that something change on sendgrid server side, it now suddenly send to recipient like this:

to: john, Array

I look into the client library into the file lib/SendGrid.php line 51

curl_setopt($ch, CURLOPT_POSTFIELDS, $form);

I put http_build_query around the $form variable and that seems to stop sendgrid server side from putting Array into the recipient list

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($form));

I think this is also a more proper way to deal with curl.

Could you investigate and incorporate the fix into the version 1.0 of the API

@VictorAcatrinei
Copy link

Indeed this seems to be causing issues. Do we have any kind of update on the problem? Thanks!

@sergchernata
Copy link

Hey guys, I have a suspicion that while this fixes the issue, it breaks attachments. Can someone verify on their end? My attachments appear but are empty.

@sergchernata
Copy link

I have just confirmed this on my end. Still would love to hear from someone else but in the meantime please beware.

@eddiezane
Copy link
Contributor

I have a pre-release up of v3.0.0 that should fix all of these issues. Would love some testers to provide feedback.

I need to write up the changes and a better README, but here's a primer.

"sendgrid/sendgrid": "3.0.0-RC1" in composer.

https://github.com/sendgrid/sendgrid-php/releases/tag/v3.0.0-RC1

@sergchernata
Copy link

I just quickly tried this out and its complaining about Guzzle not being present. Is this some new dependency?

@eddiezane
Copy link
Contributor

Yea I wound up going with Guzzle3. I tried pretty hard to stick to native curl. I even started working on another library but in the end I would have had to manually handle form/multipart encoding... That's when I realized that these big HTTP libraries exist for a reason.

The issue everyone was getting about the Array to string conversion was because curl requires a single dimension array and we are building a nested one. As people realized, http_build_query broke attachments.

@sergchernata
Copy link

So, this also bumps up your required PHP version to 5.4, correct?

@eddiezane
Copy link
Contributor

Nah thankfully Guzzle3 supports PHP 5.3 still.

On Saturday, April 4, 2015, Serg Chernata notifications@github.com wrote:

So, this also bumps up your required PHP version to 5.4, correct?


Reply to this email directly or view it on GitHub
#131 (comment)
.

Eddie Zaneski
{"device": "mobile"}

@sergchernata
Copy link

Hmm, installing via composer Guzzle is refusing to work with PHP under 5.4. Should I be suppressing that warning and ignoring it? Their docs also require 5.4

http://guzzle.readthedocs.org/en/latest/overview.html#installation

Disregard this, I'm guessing you're implying that we should install v3 exactly for that reason.

@eddiezane
Copy link
Contributor

Yea the docs for Guzzle3 are here.

I'll do some testing getting everything installed on PHP 5.3. Maybe I botched a config somewhere.

https://github.com/guzzle/guzzle3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants