From c1aad9258a2b036bc39cc8e8722a7724d86c8db2 Mon Sep 17 00:00:00 2001 From: Sergey Serbin Date: Fri, 12 Jul 2019 12:51:05 +0300 Subject: [PATCH] Defer Services_Json inclusion/initialization until really needed Alternatively, I'd consider dropping Services_Json altogether. Since php 5.2 php comes in with bundled json ext so it should be available everywhere --- class/serialisation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/class/serialisation.php b/class/serialisation.php index 8177c60..da4efb0 100644 --- a/class/serialisation.php +++ b/class/serialisation.php @@ -1,15 +1,15 @@ log_message('Getting serialiser', __FUNCTION__, CS_REST_LOG_VERBOSE); if(function_exists('json_decode') && function_exists('json_encode')) { return new CS_REST_NativeJsonSerialiser($log); } else { + if (!class_exists('Services_JSON', false)) { + require_once dirname(__FILE__).'/services_json.php'; + } + return new CS_REST_ServicesJsonSerialiser($log); } }