From 449e5fc9cf9020b62d8ed4da074e10cadfe9d95e Mon Sep 17 00:00:00 2001 From: kolorafa Date: Mon, 13 Jun 2016 18:02:26 +0200 Subject: [PATCH] Can't override CakeEmail class and use deliver When using TemplateEmail::deliver it always create new instance of CakeEmail, I assume it should create my extended "TemplateEmail" class insted. PHP >5.3 compatible --- lib/Cake/Network/Email/CakeEmail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index bf62be85a..33e37ca68 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -1203,7 +1203,7 @@ class CakeEmail { * @throws SocketException */ public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true) { - $class = __CLASS__; + $class = get_called_class(); /** @var CakeEmail $instance */ $instance = new $class($transportConfig); if ($to !== null) {