From c24c4679659841c8dffbc157c1bc3db24437b8d2 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 18 Feb 2014 17:33:24 -0800 Subject: [PATCH] CRM-13986 - CRM_Core_Invoke - Handle HTML and WS requests differently For HTML, use the CMS's output mechanism (with its theming, etc) For web services (or any non-HTML content), use Symfony's output mechanism --- CRM/Core/Invoke.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index bb0e17b38a..4a7987600b 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -117,8 +117,13 @@ class CRM_Core_Invoke { $kernel = new AppKernel('dev', true); $kernel->loadClassCache(); $response = $kernel->handle(Symfony\Component\HttpFoundation\Request::createFromGlobals()); - // $response->send(); - return $response->getContent(); + if (preg_match(':^text/html:', $response->headers->get('Content-Type'))) { + // let the CMS handle the trappings + return $response->getContent(); + } else { + $response->send(); + exit(); + } } } /** -- 2.25.1