Example #1
0
 /**
  * @param mixed[] $valueList
  * @return string
  */
 protected function _serialize(array $valueList)
 {
     $variableInspector = new CM_Debug_VariableInspector();
     $valueListString = Functional\map($valueList, function ($value) use($variableInspector) {
         return $variableInspector->getDebugInfo($value, ['recursive' => true]);
     });
     return serialize($valueListString);
 }
Example #2
0
 /**
  * @return string
  */
 public function getDebugInfo()
 {
     try {
         $variableInspector = new CM_Debug_VariableInspector();
         return $variableInspector->getDebugInfo($this->getParamsDecoded(), ['recursive' => true]);
     } catch (Exception $e) {
         return '[Cannot dump params: `' . $e->getMessage() . '`]';
     }
 }
Example #3
0
 /**
  * @param array $row
  * @return array
  */
 protected static function _extractTraceRow($row)
 {
     $traceEntry = array();
     $code = '';
     if (array_key_exists('function', $row)) {
         if (array_key_exists('class', $row)) {
             $code .= $row['class'] . '->';
         }
         $code .= $row['function'];
         if (array_key_exists('args', $row)) {
             $arguments = array();
             $variableInspector = new CM_Debug_VariableInspector();
             foreach ($row['args'] as $argument) {
                 $arguments[] = $variableInspector->getDebugInfo($argument, ['lengthMax' => 30]);
             }
             $code .= '(' . implode(', ', $arguments) . ')';
         }
         $traceEntry['code'] = $code;
     }
     if (array_key_exists('file', $row)) {
         $file = $row['file'];
         $line = $row['line'];
     } else {
         $file = null;
         $line = null;
         $code = '[internal function]';
     }
     return array('code' => $code, 'file' => $file, 'line' => $line);
 }
Example #4
0
 /**
  * @dataProvider debugInfoProviderRecursive
  *
  * @param string $expected
  * @param mixed  $argument
  */
 public function testGetDebugInfoRecursive($expected, $argument)
 {
     $variableInspector = new CM_Debug_VariableInspector();
     $this->assertSame($expected, $variableInspector->getDebugInfo($argument, ['recursive' => true]));
 }
Example #5
0
File: 48.php Project: cargomedia/cm
<?php

$rowList = CM_Db_Db::select('cm_log', '*')->fetchAll();
foreach ($rowList as $row) {
    $metaInfo = @unserialize($row['metaInfo']);
    if (is_array($metaInfo)) {
        $variableInspector = new CM_Debug_VariableInspector();
        $metaInfo = Functional\map($metaInfo, function ($value) use($variableInspector) {
            return $variableInspector->getDebugInfo($value, ['recursive' => true]);
        });
    } else {
        $metaInfo = null;
    }
    CM_Db_Db::update('cm_log', ['metaInfo' => serialize($metaInfo)], ['id' => $row['id']]);
}