Skip to content

Commit

Permalink
Defer Services_Json inclusion/initialization until really needed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sserbin committed Jul 12, 2019
1 parent d578890 commit c1aad92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions class/serialisation.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

if (!class_exists('Services_JSON', false)) {
require_once dirname(__FILE__).'/services_json.php';
}

if(!function_exists("CS_REST_SERIALISATION_get_available")) {
function CS_REST_SERIALISATION_get_available($log) {
$log->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);
}
}
Expand Down

0 comments on commit c1aad92

Please sign in to comment.