Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mailchimp Mailer Bridge: undefined index: _id when sending an email#34597

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@monteiro
Copy link
Contributor

@monteiromonteiro commentedNov 25, 2019
edited
Loading

QA
Branch?master for features / 4.4 or 5.0 for bug fixes
Bug fix?yes
New feature?no
Deprecations?no
Tickets(no ticket created)
LicenseMIT

When I set the DSN:
MAILER_DSN=mandrill://KEY@default

and try to send an email:

$reportEmail = (newEmail())            ->subject('this is a test')            ->addFrom('test@test.com')            ->addTo('test-2@test.com')            ->text('this is just a test.');$mailer->send($reportEmail);

it returns an exception:

Captura de ecrã 2019-11-25, às 14 31 59

Stacktrace:

ErrorException:Notice: Undefined index: _id  at /Users/mac/Documents/workspace/spotahome/code/opensource/symfony/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php:64  at Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillHttpTransport->doSendHttp(object(SentMessage))     (/Users/mac/Documents/workspace/spotahome/code/opensource/symfony/src/Symfony/Component/Mailer/Transport/AbstractHttpTransport.php:71)  at Symfony\Component\Mailer\Transport\AbstractHttpTransport->doSend(object(SentMessage))     (/Users/mac/Documents/workspace/spotahome/code/opensource/symfony/src/Symfony/Component/Mailer/Transport/AbstractTransport.php:71)  at Symfony\Component\Mailer\Transport\AbstractTransport->send(object(SentMessage), object(DelayedEnvelope))     (/Users/mac/Documents/workspace/spotahome/code/opensource/symfony/src/Symfony/Component/Mailer/Transport/Transports.php:51)  at Symfony\Component\Mailer\Transport\Transports->send(object(Email), null)     (/Users/mac/Documents/workspace/spotahome/code/opensource/symfony/src/Symfony/Component/Mailer/Mailer.php:41)  at Symfony\Component\Mailer\Mailer->send(object(Email))     (src/Controller/MailerController.php:20)  at App\Controller\MailerController->index(object(Mailer))

The fix, how does it work:

According todocumentation, the endpointhttps://mandrillapp.com/api/1.0/messages/send-raw.json returns an array of results in case of success:

[    {        "email": "recipient.email@example.com",        "status": "sent",        "reject_reason": "hard-bounce",        "_id": "abc123abc123abc123abc123abc123"    }]

in case of an error:

{    "status": "error",    "code": 12,    "name": "Unknown_Subaccount",    "message": "No subaccount exists with the id 'customer-123'"}

The fix just sets the right message id.

nicolas-grekasand others added30 commitsSeptember 19, 2019 19:12
* 4.4:  [Process] fix typo in tests
* 4.4:  [PhpUnitBridge] fix undefined variables
* 4.4:  [PhpUnitBridge] more fixes for PHP 5.5
* 4.4:  [HttpKernel] fix merge  fix tests  [HttpClient] fix throwing HTTP exceptions when the 1st chunk is emitted
* 4.4:  fix merge
* 4.4:  cleanup  fix tests
This PR was merged into the 5.0-dev branch.Discussion----------[TwigBundle] fix accessing service arguments| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       || License       | MIT| Doc PR        |Commits-------6233cce fix accessing service arguments
* 4.4:  [Cache] skip igbinary on PHP 7.4.0
* 4.4:  [travis] checkout previous major and test with patched components on deps=high
* 4.4:  [travis] install from dist except for selected components
* 4.4:  [FrameworkBundle] fix tests  fix typo
* 4.4:  [travis] fix testing flipped versions  [travis] honor .gitattributes when building local packages
* 4.3:  [travis] fix CI
* 4.4:  [travis] fix CI
* 4.4:  [Twig] Remove deprecated tag usage
* 4.4:  [travis] fix typo  [travis] more CI fixes
* 4.4:  [Security/Http] fix typo in deprecation message  [Security] Deprecate isGranted()/decide() on more than one attribute  Fixed a minor typo in the UPGRADE to 5.0 guide  Various tweaks 3.4  Various tweaks 4.3  [Security] Make stateful firewalls turn responses private only when needed  [PhpUnit] Fix usleep mock return value  Revert \"featuresymfony#33507 [WebProfiler] Deprecated intercept_redirects in 4.4 (dorumd)\"  [TwigBundle] typo  [TwigBundle] fix test case  [Lock] use Predis\ClientInterface instead of Predis\Client  Allow Twig 3  Minor tweaks  Fix version typo in deprecation notice  [Form][SubmitType] Add "validate" option  hint to the --parse-tags when parsing tags fails  Make legacy "wrong" RFC2047 encoding apply only to one header
* 4.4:  [Routing] fix bad fix
This PR was merged into the 5.0-dev branch.Discussion----------[Security] remove deprecated code paths| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       || License       | MIT| Doc PR        |Commits-------2b6ce01 remove deprecated code paths
This PR was merged into the 5.0-dev branch.Discussion----------[Security] remove tests for legacy behavior| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       || License       | MIT| Doc PR        |Commits-------4e0f034 remove tests for legacy behavior
…rings management with an abstract unit system (nicolas-grekas, hhamon, gharlan)This PR was merged into the 5.0-dev branch.Discussion----------[String] a new component for object-oriented strings management with an abstract unit system| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -This is a reboot ofsymfony#22184 (thanks@hhamon for working on it) and a generalization of my previous work on the topic ([patchwork/utf8](https://github.com/tchwork/utf8)). Unlike existing libraries (including `patchwork/utf8`), this component provides a unified API for the 3 unit systems of strings: bytes, code points and grapheme clusters.The unified API is defined by the `AbstractString` class. It has 2 direct child classes: `BinaryString` and `AbstractUnicodeString`, itself extended by `Utf8String` and `GraphemeString`.All objects are immutable and provide clear edge-case semantics, using exceptions and/or (nullable) types!Two helper functions are provided to create such strings:```phpnew GraphemeString('foo') == u('foo'); // when dealing with Unicode, prefer grapheme unitsnew BinaryString('foo') == b('foo');````GraphemeString` is the most linguistic-friendly variant of them, which means it's the one ppl should use most of the time *when dealing with written text*.Future ideas: - improve tests - add more docblocks (only where they'd add value!) - consider adding more methods in the string API (`is*()?`, `*Encode()`?, etc.) - first class Emoji support - merge the Inflector component into this one - use `width()` to improve `truncate()` and `wordwrap()` - move method `slug()` to a dedicated locale-aware service class - propose your ideas (send PRs after merge)Out of (current) scope: - what [intl](https://php.net/intl) provides (collations, transliterations, confusables, segmentation, etc)Here is the unified API I'm proposing in this PR, borrowed from looking at many existing libraries, but also Java, Python, JavaScript and Go.```phpfunction __construct(string $string = '');static function unwrap(array $values): arraystatic function wrap(array $values): arrayfunction after($needle, bool $includeNeedle = false, int $offset = 0): self;function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self;function append(string ...$suffix): self;function before($needle, bool $includeNeedle = false, int $offset = 0): self;function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self;function camel(): self;function chunk(int $length = 1): array;function collapseWhitespace(): selffunction endsWith($suffix): bool;function ensureEnd(string $suffix): self;function ensureStart(string $prefix): self;function equalsTo($string): bool;function folded(): self;function ignoreCase(): self;function indexOf($needle, int $offset = 0): ?int;function indexOfLast($needle, int $offset = 0): ?int;function isEmpty(): bool;function join(array $strings): self;function jsonSerialize(): string;function length(): int;function lower(): self;function match(string $pattern, int $flags = 0, int $offset = 0): array;function padBoth(int $length, string $padStr = ' '): self;function padEnd(int $length, string $padStr = ' '): self;function padStart(int $length, string $padStr = ' '): self;function prepend(string ...$prefix): self;function repeat(int $multiplier): self;function replace(string $from, string $to): self;function replaceMatches(string $fromPattern, $to): self;function slice(int $start = 0, int $length = null): self;function snake(): self;function splice(string $replacement, int $start = 0, int $length = null): self;function split(string $delimiter, int $limit = null, int $flags = null): array;function startsWith($prefix): bool;function title(bool $allWords = false): self;function toBinary(string $toEncoding = null): BinaryString;function toGrapheme(): GraphemeString;function toUtf8(): Utf8String;function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;function truncate(int $length, string $ellipsis = ''): self;function upper(): self;function width(bool $ignoreAnsiDecoration = true): int;function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self;function __clone();function __toString(): string;````AbstractUnicodeString` adds these:```phpstatic function fromCodePoints(int ...$codes): self;function ascii(array $rules = []): self;function codePoint(int $index = 0): ?int;function folded(bool $compat = true): parent;function normalize(int $form = self::NFC): self;function slug(string $separator = '-'): self;```and `BinaryString`:```phpstatic function fromRandom(int $length = 16): self;function byteCode(int $index = 0): ?int;function isUtf8(): bool;function toUtf8(string $fromEncoding = null): Utf8String;function toGrapheme(string $fromEncoding = null): GraphemeString;```Case insensitive operations are done with the `ignoreCase()` method.e.g. `b('abc')->ignoreCase()->indexOf('B')` will return `1`.For reference, CLDR transliterations (used in the `ascii()` method) are defined here:https://github.com/unicode-org/cldr/tree/master/common/transformsCommits-------dd8745a [String] add more tests82a0095 [String] add tests012e92a [String] a new component for object-oriented strings management with an abstract unit system
…sseur)This PR was merged into the 5.0-dev branch.Discussion----------[Security] Fix isGranted with object attribute| Q             | A| ------------- | ---| Branch?       | master (the added test could be backported to older branches)| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       |symfony#33697 (comment)| License       | MIT| Doc PR        |Fix calls to isGranted with `$attribute` beeing an object.Commits-------3a5fd48 Fix isGranted with object attribute
* 4.4: (28 commits)  [FrameworkBundle] Fix framework bundle lock configuration not working as expected  [Validator] Add the missing translations for the Azerbaijani locale  [HttpClient] workaround bad Content-Length sent by old libcurl  [Cache] dont override native Memcached options  Fix CS  Fix exceptions (PDOException) error code type  [ErrorHandler] fix return-type patching logic  [Messenger] Added support for `from_transport` attribute on `messenger.message_handler` tag  [ErrorHandler] don't throw deprecations for return-types by default  ensure legacy event dispatcher compatibility  ensure legacy event dispatcher compatibility  Fix return type of Process::restart().  [Cache] fail gracefully when locking is not supported  [HttpKernel] compress files generated by the profiler  tweak deprecation messages and changelog  fix version in@deprecated annotation  Use VarCloner data instead of legacy array for query params  [Security] use LegacyEventDispatcherProxy  [HttpClient] fix undefined index access  [HttpClient] fix race condition when reading response with informational status  ...
nicolas-grekasand others added18 commitsNovember 18, 2019 18:27
…(fancyweb)This PR was merged into the 5.0 branch.Discussion----------[Routing] Fix ContainerLoader and ObjectLoaderTest| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Commits-------0e5db6a [Routing] Fix ContainerLoader and ObjectLoaderTest
This PR was merged into the 5.0 branch.Discussion----------Allow PHP ^7.2.5| Q             | A| ------------- | ---| Branch?       | 5.0| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       |Fixsymfony#34442| License       | MIT| Doc PR        | -Let's what the CI says.Will need tagging all contracts as v2.0.1 after merge.Commits-------6194c2a Allow PHP ^7.2.5
* 4.4:  [Routing] fix tests  [Form] group constraints when calling the validator  Remove wrong@group legacy annotations  [DependencyInjection] Fix dumping multiple deprecated aliases  allow button names to start with uppercase letter  States that the HttpClient provides a Http Async implementation
* 5.0:  [Routing] fix tests  [DI] minor cleanup  [Form] group constraints when calling the validator  Remove wrong@group legacy annotations  [DependencyInjection] Fix dumping multiple deprecated aliases  allow button names to start with uppercase letter  Allow PHP ^7.2.5  States that the HttpClient provides a Http Async implementation  [Routing] Fix ContainerLoader and ObjectLoaderTest  [HttpKernel] Make ErrorListener::onKernelException()'s dispatcher argument explicit  [HttpKernel] Drop deprecated ExceptionListener  Removed extra whitespace  [Security] Fix best encoder not wired using migrate_from
…essageEvent (chapa)This PR was squashed before being merged into the 5.1-dev branch (closessymfony#34475).Discussion----------[Mailer] Add UPGRADE entries about Envelope and MessageEvent* Class `SmtpEnvelope` has been renamed to `Envelope` insymfony#33562* A required `$transport` argument has been added to `MessageEvent` insymfony#32927| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | N/A| License       | MIT| Doc PR        | already up-to-dateCommits-------7baa295 [Mailer] Add UPGRADE entries about Envelope and MessageEvent
…n + better default message in case it is not set
…hod (koenreiniers)This PR was squashed before being merged into the 5.1-dev branch (closessymfony#34457).Discussion----------Added context to exceptions thrown in apply method| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets       || License       | MIT| Doc PR        |During the workflow and state machines workshop at SymfonyCon, we noticed that the context in the apply method was not passed to the exceptions that are thrown. This could prove to be convenient for debugging purposes.Commits-------8f86c33 Added context to exceptions thrown in apply method
…e when blocking a transition + better default message in case it is not set (lyrixx)This PR was merged into the 5.1-dev branch.Discussion----------[DX] [Workflow] Added a way to specify a message when blocking a transition + better default message in case it is not set| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       |Fixsymfony#34466| License       | MIT| Doc PR        |Commits-------169bb2f [Workflow] Added a way to specify a message when blocking a transition + better default message in case it is not set
… (PHP 7.4) (dunglas)This PR was squashed before being merged into the 5.1-dev branch (closessymfony#34557).Discussion----------[PropertyInfo] Add support for typed properties (PHP 7.4)| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->| License       | MIT| Doc PR        | n/aAdd support for [typed properties](https://wiki.php.net/rfc/typed_properties_v2), a new feature introduced in PHP 7.4:```phpclass Foo{    public Bar $bar;    private ?bool $nullableBoolProp;}$this->extractor->getTypes(Foo::class, 'bar'); // Type[]$this->extractor->getTypes(Foo::class, 'nullableBoolProp'); // Type[]```#SymfonyHackdayCommits-------7edfe4f [PropertyInfo] Add support for typed properties (PHP 7.4)
…altsov)This PR was squashed before being merged into the 5.1-dev branch (closessymfony#32937).Discussion----------[Routing] Deprecate RouteCollectionBuilder| Q             | A| ------------- | ---| Branch?       | 5.1| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |symfony#32240| License       | MIT| Doc PR        |symfony/symfony-docs#12688| Recipe PR |symfony/recipes#690A lot to be done here after the implementation is accepted:- [x] finish deprecations in the MicroKernelTrait- [x] deprecate the class- [x] mention in the CHANGELOG file- [x] mention in the UPGRADE file- [x] mark tests as legacy- [x] add a doc PR- [x] update the recipePing@Tobion ,@nicolas-grekas .Commits-------e641cbd [Routing] Deprecate RouteCollectionBuilder
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good to me. Can you change the target branch to 4.4 instead?

]);

$result =$response->toArray(false);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you revert this change?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Absolutely!

@monteiromonteiro changed the base branch frommaster to4.4November 25, 2019 14:51
@monteiro
Copy link
ContributorAuthor

let me just create another PR.

@monteiromonteiro deleted the fix/mandrill-http-transport-undefined_id branchNovember 25, 2019 14:51
@monteiro
Copy link
ContributorAuthor

@fabpot just created#34599 👍

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot requested changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

29 participants

@monteiro@fabpot@carsonbot@nicolas-grekas@xabbuh@hhamon@gharlan@jvasseur@chalasr@pierredup@lyrixx@tgalopin@jschaedl@fancyweb@jakzal@ostrolucky@derrabus@javiereguiluz@honarkhah@Tobion@simPod@alex-bacart@chr-hertel@yceruto@wouterj@chapa@koenreiniers@dunglas@vudaltsov

[8]ページ先頭

©2009-2025 Movatter.jp