]> git.mxchange.org Git - hub.git/commitdiff
Serializing data to a JSON array string is much faster than using serialize().
authorRoland Haeder <roland@mxchange.org>
Wed, 29 Apr 2015 09:00:03 +0000 (11:00 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 29 Apr 2015 09:00:03 +0000 (11:00 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/main/handler/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php
application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php
application/hub/starter.php

index dfd98384c1d78f084335cbc3b07d6bcd703b2edc..128dbc3004265ef052fc8a310c147ff43b1ec3f9 100644 (file)
@@ -67,7 +67,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnserStatusHandler implements
                assert(isset($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST]));
 
                // Save node list
-               $nodeList = unserialize(base64_decode($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST]));
+               $nodeList = json_decode(base64_decode($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST]));
 
                // Make sure it is completely decoded
                assert(is_array($nodeList));
index 54500de6a5319705379bd5acd2d092de1e136f11..35b609e4ca4cee602916e74e6e398541c06e8859 100644 (file)
@@ -180,7 +180,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                assert(count($nodeList) > 0);
 
                // Set it in configuration
-               $this->getConfigInstance()->setConfigEntry('dht_nodes', base64_encode(serialize($nodeList)));
+               $this->getConfigInstance()->setConfigEntry('dht_nodes', base64_encode(json_encode($nodeList)));
        }
 
        /**
index 442f69e22a4139235a9df02429521867ad4e5e20..92cc25eacdeac5a15a13c280a43a30e77bbd8e80 100644 (file)
@@ -143,7 +143,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Got a node list of ' . count($nodeList) . ' entry/-ies back.');
 
                // Set it serialized in configuration (temporarily)
-               $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(serialize($nodeList)));
+               $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(json_encode($nodeList)));
 
                // Translate last exception into a status code
                $statusCode = $this->getTranslatedStatusFromLastException();
index 10e1943737a383703d93516d586919095962a1a2..6abc2e6168124c0950cba17e15562ecf3499cc06 100644 (file)
@@ -33,18 +33,18 @@ $app = call_user_func_array(
 // Some sanity checks
 if ((empty($app)) || (is_null($app))) {
        // Something went wrong!
-       ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the helper class <span class=\"class_name\">%s</span> is not loaded.",
+       ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because the helper class <span class="class_name">%s</span> is not loaded.',
                $application,
                FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class')
        ));
 } elseif (!is_object($app)) {
        // No object!
-       ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because &#39;app&#39; is not an object.",
+       ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because &#39;app&#39; is not an object.',
                $application
        ));
 } elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) {
        // Method not found!
-       ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
+       ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> could not be launched because the method <span class="method_name">%s</span> is missing.',
                $application,
                FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')
        ));