Exemplo n.º 1
0
function serializationAction(&$body)
{
    //Take the raw response
    $rawResponse =& $body->getResults();
    error_log("[SWX] INFO Method call result = {$rawResponse}");
    adapterMap($rawResponse);
    $swxAssembler = null;
    $defaultFormat = 'as2';
    if (isset($_POST['format'])) {
        $defaultFormat = $_POST['format'];
    } elseif (isset($_GET['format'])) {
        $defaultFormat = $_GET['format'];
    }
    error_log('encoding with ' . $defaultFormat);
    if ($defaultFormat == 'as3') {
        require_once SWX_BASE . 'SwxAssembler3.php';
        $swxAssembler = new SwxAssembler3();
    } else {
        require_once SWX_BASE . 'SwxAssembler.php';
        $swxAssembler = new SwxAssembler();
    }
    ob_start();
    $swxAssembler->writeSwf($rawResponse, $GLOBALS['swx']['debug'], 4, $GLOBALS['swx']['url']);
    $rawResponse = ob_get_contents();
    ob_end_clean();
    $body->setResults($rawResponse);
}
Exemplo n.º 2
0
function errorHandler($errorNum, $errorStr, $errorFile, $errorLine)
{
    $errorMsg = "Error {$errorNum}: {$errorStr} in {$errorFile}, line {$errorLine}.";
    $GLOBALS['swxLastErrorMessage'] = $errorMsg;
    // Display the error message in the PHP error log
    error_log($errorMsg);
    if ($errorNum != E_STRICT && $errorNum != E_NOTICE) {
        // On errors and warnings, stop execution and return the
        // error message to the client. This is a far better
        // alternative to failing silently.
        error_log($errorMsg);
        $swxAssembler = new SwxAssembler();
        $swxAssembler->writeSwf($errorMsg, !empty($GLOBALS['swx']['debug']) ? $GLOBALS['swx']['debug'] : false);
        exit;
    }
}
Exemplo n.º 3
0
 function VerboseException($string, $level, $file, $line)
 {
     $this->description = $string;
     $this->level = $level;
     $this->code = "AMFPHP_RUNTIME_ERROR";
     $this->file = $file;
     $this->line = $line;
     Exception::__construct($string);
     $errorMsg = "Error {$level}: {$string} in {$file}, line {$line}.";
     $GLOBALS['swxLastErrorMessage'] = $errorMsg;
     // Display the error message in the PHP error log
     error_log($errorMsg);
     if ($level != E_STRICT && $level != E_NOTICE) {
         // On errors and warnings, stop execution and return the
         // error message to the client. This is a far better
         // alternative to failing silently.
         error_log($errorMsg);
         $swxAssembler = new SwxAssembler();
         $swxAssembler->writeSwf($errorMsg, !empty($GLOBALS['swx']['debug']) ? $GLOBALS['swx']['debug'] : false);
         exit;
     }
 }
Exemplo n.º 4
0
// Call the method, passing the array's elements as individual elements.
$result = call_user_func_array(array(&$instance, $method), $dataAsPhp);
// Profiling:
if (LOG_ALL) {
    $methodDuration = microtime_float() - $methodStartTime;
    error_log("[SWX] PROFILING: Method took {$methodDuration} seconds to return a result.");
    $duration = microtime_float() - $startTime;
    $swxGatewayOverhead = $duration - $jsonDuration - $methodDuration;
    error_log("[SWX] PROFILING: All other SWX gateway operations took {$swxGatewayOverhead} seconds.");
    // Debug:
    // error_log ("[SWX] INFO Method call result = $result");
    $swxAssemblerStartTime = microtime_float();
    // Reset the timer.
}
// Create and write out the SWF.
$swxAssembler->writeSwf($result, $debug, $compressionLevel, $url);
if (LOG_ALL) {
    // Profiling:
    $swxCompilerDuration = microtime_float() - $swxAssemblerStartTime;
    $duration = microtime_float() - $startTime;
    // Status message.
    error_log("[SWX] PROFILING: SWF compiler took {$swxCompilerDuration} seconds to assemble the data SWF.");
    // Call profiling stats:
    $jsonPercentage = round($jsonDuration * 100 / $duration, 0);
    $swxAssemblerPercentage = round($swxCompilerDuration * 100 / $duration, 0);
    $methodPercentage = round($methodDuration * 100 / $duration, 0);
    $otherPercentage = 100 - $jsonPercentage - $swxAssemblerPercentage - $methodPercentage;
    error_log("[SWX] PROFILING: SWX call took {$duration} seconds in total, of which JSON decoding arguments: {$jsonPercentage}%, Service method: {$methodPercentage}%, SWX Data SWF assembly: {$swxAssemblerPercentage}%, Other: {$otherPercentage}%.");
    // Profiler:
    /*
    error_log("[SWX] PROFILER INFO FOLLOWS:");