Skip to content

Commit

Permalink
Merge pull request cakephp#728 from cakephp/double-wrap-transport
Browse files Browse the repository at this point in the history
Don't double wrap transports
  • Loading branch information
markstory authored Jan 16, 2020
2 parents 20f2260 + c08193b commit 5680528
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Panel/MailPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,24 @@ public function initialize()

$log = $this->emailLog = new ArrayObject();

foreach ($configs as $name => &$transport) {
foreach ($configs as $name => $transport) {
if (is_object($transport)) {
$configs[$name] = new DebugKitTransport(['debugKitLog' => $log], $transport);
if (!$transport instanceof DebugKitTransport) {
$configs[$name] = new DebugKitTransport(['debugKitLog' => $log], $transport);
}
continue;
}

$className = App::className($transport['className'], 'Mailer/Transport', 'Transport');

if (!$className) {
if (!$className || $className === DebugKitTransport::class) {
continue;
}

$transport['originalClassName'] = $transport['className'];
$transport['className'] = 'DebugKit.DebugKit';
$transport['debugKitLog'] = $log;

$configs[$name] = $transport;
}
$property->setValue($configs);
}
Expand Down

0 comments on commit 5680528

Please sign in to comment.