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

Error to update to PHP 7.2 #17

Open
Macbenach opened this issue May 14, 2018 · 7 comments
Open

Error to update to PHP 7.2 #17

Macbenach opened this issue May 14, 2018 · 7 comments

Comments

@Macbenach
Copy link

When send email apperace this error after update my server to PHP 7.2

message: count(): Parameter must be an array or an object that implements Countable"

file: "/var/www/html/tfd_rh_api/vendor/sendgrid/sendgrid/lib/SendGrid/Email.php"

References:

yiisoft/yii#4167
Automattic/jetpack#8420
invoiceninja/invoiceninja#1767

@neverabe
Copy link

@bryglen, there is a way to solve this, did you prefer @Macbenach and me make a PR?

@bryglen
Copy link
Owner

bryglen commented May 16, 2018

this is a known issue on 7.2, as of now no support for 7.2

@neverabe
Copy link

@bryglen dude, plz upgrade your composer.json at least 6.++, see reference https://github.com/sendgrid/sendgrid-php/releases, you library are to old, plz make the update.

@neverabe
Copy link

Hello @bryglen what you think about this snippet

  public function getHeadersJson() {
    if ($this->getHeaders() == NULL) {
     return "{}";
    }

    if (count($this->getHeaders()) <= 0) {
     return "{}";
    }
    return json_encode($this->getHeaders(), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
  }

Maybe exist some better code but it seems to solve the problem in php 7.2, i test it in PHP 7.2 and 7.0

@neverabe
Copy link

@bryglen, help us

@bryglen
Copy link
Owner

bryglen commented Jul 12, 2018

please create PR

@jyotiprava
Copy link

Hello guys,
Can use this package https://github.com/ramprasadm1986/yii2-sendgrid

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