Ejemplo n.º 1
0
function main()
{
    ini_set('xdebug.enable', 1);
    ini_set('xdebug.default_enable', 1);
    ini_set('xdebug.overload_var_dump', 2);
    $arr = array(5);
    $b =& $arr[0];
    xdebug_var_dump($arr);
    xdebug_var_dump($b);
}
 public function onStart(EnvironmentEvent $event)
 {
     xdebug_break();
     $this->io = $event->getIO();
     $this->io->write('<comment>SpressSitemapXML::onStart.</comment>');
     $sourceDir = $event->getSourceDir();
     $repository = $event->getConfigRepository();
     $dataDir = $sourceDir . '/_data';
     $data = [];
     xdebug_var_dump($data);
     var_dump(array(array(TRUE, 2, 3.14, 'foo'), 'object' => $c));
 }
Ejemplo n.º 3
0
 function p($r)
 {
     if (function_exists('xdebug_var_dump')) {
         echo '<pre>';
         xdebug_var_dump($r);
         echo '</pre>';
         //(new \Phalcon\Debug\Dump())->dump($r, true);
     } else {
         echo '<pre>';
         var_dump($r);
         echo '</pre>';
     }
 }
Ejemplo n.º 4
0
 /**
  * print out type and content of the given variable if DEBUG-define (in config/core.php) > 0
  * @param mixed $var     Variable to debug
  */
 function debug($var = false)
 {
     if (DEBUG < 1) {
         return;
     }
     ob_start();
     if (function_exists('xdebug_var_dump')) {
         xdebug_var_dump($var);
     } else {
         var_dump($var);
     }
     $var = ob_get_clean();
     kataDebugOutput($var);
 }
function quark_dump($var, $return = FALSE, $use_xdebug = TRUE)
{
    $use_xdebug = $use_xdebug && function_exists('xdebug_var_dump');
    if ($return) {
        if ($use_xdebug && function_exists('ob_start')) {
            ob_start();
            xdebug_var_dump($var);
            $out = ob_get_contents();
            ob_end_clean();
        } else {
            $out = "<pre class='quark-dump'>" . htmlentities(var_export($var, $return), ENT_QUOTES, "utf-8") . "</pre>";
        }
        return $out;
    } else {
        if ($use_xdebug) {
            xdebug_var_dump($var);
        } else {
            echo "<pre class='quark-dump'>" . htmlentities(var_export($var, TRUE), ENT_QUOTES, "utf-8") . "</pre>";
        }
    }
}
Ejemplo n.º 6
0
 public function __construct()
 {
     /* Chargement de la configuration */
     try {
         $this->database_connection = new PDO(DSN, USER_BDD, MDP_BDD, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
         $this->database_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $this->database_connection->setAttribute(PDO::ATTR_PERSISTENT, true);
     } catch (PDOException $e) {
         xdebug_var_dump($e);
         /*$oError = new clsError();
           $oError->ErrorFile = __FILE__;
           $oError->ErrorFunction = __FUNCTION__;
           $oError->ErrorCode = $e->getCode();
           $oError->ErrorMessage = $e->getMessage();
           $oError->ErrorTrace = $e->getTraceAsString();
           
           $oError->showError();
           die();*/
     }
     return $this->database_connection;
 }
Ejemplo n.º 7
0
/**
 * Wrap pre tag around {@link var_dump()} for better debugging.
 *
 * @param $var__var__var__var__,... mixed variable(s) to dump
 * @return true
 */
function pre_dump($var__var__var__var__)
{
    global $is_cli;
    #echo 'pre_dump(): '.debug_get_backtrace(); // see where a pre_dump() comes from
    $func_num_args = func_num_args();
    $count = 0;
    if (!empty($is_cli)) {
        // CLI, no encoding of special chars:
        $count = 0;
        foreach (func_get_args() as $lvar) {
            var_dump($lvar);
            $count++;
            if ($count < $func_num_args) {
                // Put newline between arguments
                echo "\n";
            }
        }
    } elseif (function_exists('xdebug_var_dump')) {
        // xdebug already does fancy displaying:
        // no limits:
        $old_var_display_max_children = ini_set('xdebug.var_display_max_children', -1);
        // default: 128
        $old_var_display_max_data = ini_set('xdebug.var_display_max_data', -1);
        // max string length; default: 512
        $old_var_display_max_depth = ini_set('xdebug.var_display_max_depth', -1);
        // default: 3
        echo "\n<div style=\"padding:1ex;border:1px solid #00f;\">\n";
        foreach (func_get_args() as $lvar) {
            xdebug_var_dump($lvar);
            $count++;
            if ($count < $func_num_args) {
                // Put HR between arguments
                echo "<hr />\n";
            }
        }
        echo '</div>';
        // restore xdebug settings:
        ini_set('xdebug.var_display_max_children', $old_var_display_max_children);
        ini_set('xdebug.var_display_max_data', $old_var_display_max_data);
        ini_set('xdebug.var_display_max_depth', $old_var_display_max_depth);
    } else {
        $orig_html_errors = ini_set('html_errors', 0);
        // e.g. xdebug would use fancy html, if this is on; we catch (and use) xdebug explicitly above, but just in case
        echo "\n<pre style=\"padding:1ex;border:1px solid #00f;\">\n";
        foreach (func_get_args() as $lvar) {
            ob_start();
            var_dump($lvar);
            // includes "\n"; do not use var_export() because it does not detect recursion by design
            $buffer = ob_get_contents();
            ob_end_clean();
            echo htmlspecialchars($buffer);
            $count++;
            if ($count < $func_num_args) {
                // Put HR between arguments
                echo "<hr />\n";
            }
        }
        echo "</pre>\n";
        ini_set('html_errors', $orig_html_errors);
    }
    evo_flush();
    return true;
}
Ejemplo n.º 8
0
Archivo: XDebug.php Proyecto: ksst/kf
 public static function showCallStack()
 {
     echo 'CallStack - File: ' . xdebug_call_file();
     echo '<br />Class: ' . xdebug_call_class();
     echo '<br />Function: ' . xdebug_call_function();
     echo '<br />Line: ' . xdebug_call_line();
     echo '<br />Depth of Stacks: ' . xdebug_get_stack_depth();
     echo '<br />Content of Stack: ' . xdebug_var_dump(xdebug_get_function_stack());
 }
Ejemplo n.º 9
0
function dump($value)
{
    if (function_exists('xdebug_var_dump')) {
        ob_start();
        xdebug_var_dump($value);
        $value = ob_get_clean();
    } else {
        $value = '<pre>' . escape(print_r($value, true)) . '</pre>';
    }
    return $value;
}
Ejemplo n.º 10
0
/**
 * @package Debug
 */
function p($src, $Type = 'LOG')
{
    if (!Kwf_Debug::isEnabled()) {
        return;
    }
    $isToDebug = false;
    if ($Type != 'ECHO' && class_exists('FirePHP') && FirePHP::getInstance()) {
        if (is_object($src) && method_exists($src, 'toArray')) {
            $src = $src->toArray();
        } else {
            if (is_object($src)) {
                $src = (array) $src;
            }
        }
        //wenn FirePHP nicht aktiv im browser gibts false zurück
        if (FirePHP::getInstance()->fb($src, $Type)) {
            return;
        }
    }
    if (is_object($src) && method_exists($src, 'toDebug')) {
        $isToDebug = true;
        $src = $src->toDebug();
    }
    if (is_object($src) && method_exists($src, '__toString')) {
        $src = $src->__toString();
    }
    if (is_array($src)) {
        $isToDebug = true;
        if ($Type == 'TABLE' && php_sapi_name() != 'cli') {
            $table = '';
            $i = 0;
            foreach ($src[1] as $row) {
                $table .= "<tr>";
                foreach ($row as $td) {
                    if ($i == 0) {
                        $table .= "<th>{$td}</th>";
                    } else {
                        $table .= "<td>{$td}</td>";
                    }
                }
                $table .= "</tr>\n";
                $i++;
            }
            $src = $src[0] . "<br />\n<table>\n" . $table . "</table>\n";
        } else {
            $src = _pArray($src);
            if (php_sapi_name() == 'cli') {
                $src = "\n{$src}";
            } else {
                $src = "<pre>\n{$src}</pre>";
            }
        }
    }
    if ($isToDebug) {
        if (php_sapi_name() == 'cli') {
            $src = str_replace('<pre>', '', $src);
            $src = str_replace('</pre>', '', $src);
        }
        echo $src;
    } else {
        if (function_exists('xdebug_var_dump') && !($src instanceof Zend_Db_Select || $src instanceof Exception)) {
            xdebug_var_dump($src);
        } else {
            if (php_sapi_name() != 'cli') {
                echo "<pre>";
            }
            var_dump($src);
            if (php_sapi_name() != 'cli') {
                echo "</pre>";
            }
        }
    }
    if (function_exists('debug_backtrace')) {
        $bt = debug_backtrace();
        $i = 0;
        if (isset($bt[1]) && isset($bt[1]['function']) && $bt[1]['function'] == 'd') {
            $i = 1;
        }
        if (isset($bt[$i]) && isset($bt[$i]['function']) && $bt[$i]['function'] == 'bt') {
            $i++;
        }
        echo $bt[$i]['file'] . ':' . $bt[$i]['line'];
        if (php_sapi_name() != 'cli') {
            echo "<br />";
        }
        echo "\n";
    }
}
Ejemplo n.º 11
0
<?php

$array = array(1, true, "string");
xdebug_var_dump($array);
echo "\n\n";
ini_set('xdebug.var_display_max_depth', 0);
xdebug_var_dump($array);
echo "\n\n";
ini_set('xdebug.var_display_max_depth', -1);
ini_set('xdebug.var_display_max_data', 0);
xdebug_var_dump($array);
echo "\n\n";
ini_set('xdebug.var_display_max_children', 0);
ini_set('xdebug.var_display_max_data', -1);
xdebug_var_dump($array);
echo "\n\n";
Ejemplo n.º 12
0
function hhb_var_dump()
{
    //informative wrapper for var_dump
    //<changelog>
    //version 5 ( 1372510379573 )
    //v5, fixed warnings on PHP < 5.0.2 (PHP_EOL not defined),
    //also we can use xdebug_var_dump when available now. tested working with 5.0.0 to 5.5.0beta2 (thanks to http://viper-7.com and http://3v4l.org )
    //and fixed a (corner-case) bug with "0" (empty() considders string("0") to be empty, this caused a bug in sourcecode analyze)
    //v4, now (tries to) tell you the source code that lead to the variables
    //v3, HHB_VAR_DUMP_START and HHB_VAR_DUMP_END .
    //v2, now compat with.. PHP5.0 + i think? tested down to 5.2.17 (previously only 5.4.0+ worked)
    //</changelog>
    //<settings>
    $settings = array();
    $PHP_EOL = "\n";
    if (defined('PHP_EOL')) {
        //for PHP >=5.0.2 ...
        $PHP_EOL = PHP_EOL;
    }
    $settings['debug_hhb_var_dump'] = false;
    //if true, may throw exceptions on errors..
    $settings['use_xdebug_var_dump'] = false;
    //try to use xdebug_var_dump (instead of var_dump) if available?
    $settings['analyze_sourcecode'] = true;
    //false to disable the source code analyze stuff.
    //(it will fallback to making $settings['analyze_sourcecode']=false, if it fail to analyze the code, anyway..)
    $settings['hhb_var_dump_prepend'] = 'HHB_VAR_DUMP_START' . $PHP_EOL;
    $settings['hhb_var_dump_append'] = 'HHB_VAR_DUMP_END' . $PHP_EOL;
    //</settings>
    $settings['use_xdebug_var_dump'] = $settings['use_xdebug_var_dump'] && is_callable("xdebug_var_dump");
    $argv = func_get_args();
    $argc = count($argv, COUNT_NORMAL);
    if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
        $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
    } else {
        if (version_compare(PHP_VERSION, '5.3.6', '>=')) {
            $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
        } else {
            if (version_compare(PHP_VERSION, '5.2.5', '>=')) {
                $bt = debug_backtrace(false);
            } else {
                $bt = debug_backtrace();
            }
        }
    }
    $analyze_sourcecode = $settings['analyze_sourcecode'];
    //later, $analyze_sourcecode will be compared with $config['analyze_sourcecode']
    //to determine if the reason was an error analyzing, or if it was disabled..
    $bt = $bt[0];
    //<analyzeSourceCode>
    if ($analyze_sourcecode) {
        $argvSourceCode = array(0 => 'ignore [0]...');
        try {
            if (version_compare(PHP_VERSION, '5.2.2', '<')) {
                throw new Exception("PHP version is <5.2.2 .. see token_get_all changelog..");
            }
            $xsource = file_get_contents($bt['file']);
            if (empty($xsource)) {
                throw new Exception('cant get the source of ' . $bt['file']);
            }
            $xsource .= "\n<" . '?' . 'php ignore_this_hhb_var_dump_workaround();';
            //workaround, making sure that at least 1 token is an array, and has the $tok[2] >= line of hhb_var_dump
            $xTokenArray = token_get_all($xsource);
            //<trim$xTokenArray>
            $tmpstr = '';
            $tmpUnsetKeyArray = array();
            foreach ($xTokenArray as $xKey => $xToken) {
                if (is_array($xToken)) {
                    if (!array_key_exists(1, $xToken)) {
                        throw new LogicException('Impossible situation? $xToken is_array, but does not have $xToken[1] ...');
                    }
                    $tmpstr = trim($xToken[1]);
                    if (empty($tmpstr) && $tmpstr !== '0') {
                        $tmpUnsetKeyArray[] = $xKey;
                        continue;
                    }
                    switch ($xToken[0]) {
                        case T_COMMENT:
                        case T_DOC_COMMENT:
                            //T_ML_COMMENT in PHP4 -.-
                        //T_ML_COMMENT in PHP4 -.-
                        case T_INLINE_HTML:
                            $tmpUnsetKeyArray[] = $xKey;
                            continue;
                        default:
                            continue;
                    }
                } else {
                    if (is_string($xToken)) {
                        $tmpstr = trim($xToken);
                        if (empty($tmpstr) && $tmpstr !== '0') {
                            $tmpUnsetKeyArray[] = $xKey;
                        }
                        continue;
                    } else {
                        //should be unreachable..
                        //failed both is_array() and is_string() ???
                        throw new LogicException('Impossible! $xToken fails both is_array() and is_string() !! .. ');
                    }
                }
            }
            foreach ($tmpUnsetKeyArray as $toUnset) {
                unset($xTokenArray[$toUnset]);
            }
            $xTokenArray = array_values($xTokenArray);
            //fixing the keys..
            //die(var_dump('die(var_dump(...)) in '.__FILE__.':'.__LINE__,'before:',count(token_get_all($xsource),COUNT_NORMAL),'after',count($xTokenArray,COUNT_NORMAL)));
            unset($tmpstr, $xKey, $xToken, $toUnset, $tmpUnsetKeyArray);
            //</trim$xTokenArray>
            $firstInterestingLineTokenKey = -1;
            $lastInterestingLineTokenKey = -1;
            //<find$lastInterestingLineTokenKey>
            foreach ($xTokenArray as $xKey => $xToken) {
                if (!is_array($xToken) || !array_key_exists(2, $xToken) || !is_integer($xToken[2]) || $xToken[2] < $bt['line']) {
                    continue;
                }
                $tmpkey = $xKey;
                //we don't got what we want yet..
                while (true) {
                    if (!array_key_exists($tmpkey, $xTokenArray)) {
                        throw new Exception('1unable to find $lastInterestingLineTokenKey !');
                    }
                    if ($xTokenArray[$tmpkey] === ';') {
                        //var_dump(__LINE__.":SUCCESS WITH",$tmpkey,$xTokenArray[$tmpkey]);
                        $lastInterestingLineTokenKey = $tmpkey;
                        break;
                    }
                    //var_dump(__LINE__.":FAIL WITH ",$tmpkey,$xTokenArray[$tmpkey]);
                    //if $xTokenArray has >=PHP_INT_MAX keys, we don't want an infinite loop, do we? ;p
                    //i wonder how much memory that would require though.. over-engineering, err, time-wasting, ftw?
                    if ($tmpkey >= PHP_INT_MAX) {
                        throw new Exception('2unable to find $lastIntperestingLineTokenKey ! (PHP_INT_MAX reached without finding ";"...)');
                    }
                    ++$tmpkey;
                }
                break;
            }
            if ($lastInterestingLineTokenKey <= -1) {
                throw new Exception('3unable to find $lastInterestingLineTokenKey !');
            }
            unset($xKey, $xToken, $tmpkey);
            //</find$lastInterestingLineTokenKey>
            //<find$firstInterestingLineTokenKey>
            //now work ourselves backwards from $lastInterestingLineTokenKey to the first token where $xTokenArray[$tmpi][1] == "hhb_var_dump"
            //i doubt this is fool-proof but.. cant think of a better way (in userland, anyway) atm..
            $tmpi = $lastInterestingLineTokenKey;
            do {
                if (array_key_exists($tmpi, $xTokenArray) && is_array($xTokenArray[$tmpi]) && array_key_exists(1, $xTokenArray[$tmpi]) && is_string($xTokenArray[$tmpi][1]) && strcasecmp($xTokenArray[$tmpi][1], $bt['function']) === 0) {
                    //var_dump(__LINE__."SUCCESS WITH",$tmpi,$xTokenArray[$tmpi]);
                    if (!array_key_exists($tmpi + 2, $xTokenArray)) {
                        //+2 because [0] is (or should be) "hhb_var_dump" and [1] is (or should be) "("
                        throw new Exception('1unable to find the $firstInterestingLineTokenKey...');
                    }
                    $firstInterestingLineTokenKey = $tmpi + 2;
                    break;
                    /**/
                }
                //var_dump(__LINE__."FAIL WITH ",$tmpi,$xTokenArray[$tmpi]);
                --$tmpi;
            } while (-1 < $tmpi);
            //die(var_dump('die(var_dump(...)) in '.__FILE__.':'.__LINE__,$tmpi));
            if ($firstInterestingLineTokenKey <= -1) {
                throw new Exception('2unable to find the $firstInterestingLineTokenKey...');
            }
            unset($tmpi);
            //Note: $lastInterestingLineTokeyKey is likely to contain more stuff than only the stuff we want..
            //</find$firstInterestingLineTokenKey>
            //<rebuildInterestingSourceCode>
            //ok, now we have $firstInterestingLineTokenKey and $lastInterestingLineTokenKey....
            $interestingTokensArray = array_slice($xTokenArray, $firstInterestingLineTokenKey, $lastInterestingLineTokenKey - $firstInterestingLineTokenKey + 1);
            unset($addUntil, $tmpi, $tmpstr, $tmpi, $argvsourcestr, $tmpkey, $xTokenKey, $xToken);
            $addUntil = array();
            $tmpi = 0;
            $tmpstr = "";
            $tmpkey = "";
            $argvsourcestr = "";
            //$argvSourceCode[X]='source code..';
            foreach ($interestingTokensArray as $xTokenKey => $xToken) {
                if (is_array($xToken)) {
                    $tmpstr = $xToken[1];
                    //var_dump($xToken[1]);
                } else {
                    if (is_string($xToken)) {
                        $tmpstr = $xToken;
                        //var_dump($xToken);
                    } else {
                        /*should never reach this */
                        throw new LogicException('Impossible situation? $xToken fails is_array() and fails is_string() ...');
                    }
                }
                $argvsourcestr .= $tmpstr;
                if ($xToken === '(') {
                    $addUntil[] = ')';
                    continue;
                } else {
                    if ($xToken === '[') {
                        $addUntil[] = ']';
                        continue;
                    }
                }
                if ($xToken === ')' || $xToken === ']') {
                    if (false === ($tmpkey = array_search($xToken, $addUntil, false))) {
                        $argvSourceCode[] = substr($argvsourcestr, 0, -1);
                        //-1 is to strip the ")"
                        if (count($argvSourceCode, COUNT_NORMAL) - 1 === $argc) {
                            break;
                            /*We read em all! :D (.. i hope)*/
                        }
                        /*else... oh crap*/
                        throw new Exception('failed to read source code of (what i think is) argv[' . count($argvSourceCode, COUNT_NORMAL) . '] ! sorry..');
                    }
                    unset($addUntil[$tmpkey]);
                    continue;
                }
                if (empty($addUntil) && $xToken === ',') {
                    $argvSourceCode[] = substr($argvsourcestr, 0, -1);
                    //-1 is to strip the comma
                    $argvsourcestr = "";
                }
            }
            //die(var_dump('die(var_dump(...)) in '.__FILE__.':'.__LINE__,
            //$firstInterestingLineTokenKey,$lastInterestingLineTokenKey,$interestingTokensArray,$tmpstr
            //$argvSourceCode));
            if (count($argvSourceCode, COUNT_NORMAL) - 1 != $argc) {
                throw new Exception('failed to read source code of all the arguments! (and idk which ones i missed)! sorry..');
            }
            //</rebuildInterestingSourceCode>
        } catch (Exception $ex) {
            $argvSourceCode = array();
            //clear it
            //TODO: failed to read source code
            //die("TODO N STUFF..".__FILE__.__LINE__);
            $analyze_sourcecode = false;
            //ERROR..
            if ($settings['debug_hhb_var_dump']) {
                throw $ex;
            } else {
                /*exception ignored, continue as normal without $analyze_sourcecode */
            }
        }
        unset($xsource, $xToken, $xTokenArray, $firstInterestingLineTokenKey, $lastInterestingLineTokenKey, $xTokenKey, $tmpi, $tmpkey, $argvsourcestr);
    }
    //</analyzeSourceCode>
    $msg = $settings['hhb_var_dump_prepend'];
    if ($analyze_sourcecode != $settings['analyze_sourcecode']) {
        $msg .= ' (PS: some error analyzing source code)' . $PHP_EOL;
    }
    $msg .= 'in "' . $bt['file'] . '": on line "' . $bt['line'] . '": ' . $argc . ' variable' . ($argc === 1 ? '' : 's') . $PHP_EOL;
    //because over-engineering ftw?
    if ($analyze_sourcecode) {
        $msg .= ' hhb_var_dump(';
        $msg .= implode(",", array_slice($argvSourceCode, 1));
        //$argvSourceCode[0] is bullshit.
        $msg .= ')' . $PHP_EOL;
    }
    //array_unshift($bt,$msg);
    echo $msg;
    $i = 0;
    foreach ($argv as &$val) {
        echo 'argv[' . ++$i . ']';
        if ($analyze_sourcecode) {
            echo ' >>>' . $argvSourceCode[$i] . '<<<';
        }
        echo ':';
        if ($settings['use_xdebug_var_dump']) {
            xdebug_var_dump($val);
        } else {
            var_dump($val);
        }
    }
    echo $settings['hhb_var_dump_append'];
    //call_user_func_array("var_dump",$args);
}
Ejemplo n.º 13
0
<?php

function getPermFlags($data)
{
    $codes = ($data & 2048 ? 'u' : '-') . ($data & 1024 ? 'g' : '-') . ($data & 512 ? 's' : '-');
    $owner = ($data & 256 ? 'r' : '-') . ($data & 128 ? 'w' : '-') . ($data & 64 ? 'x' : '-');
    $group = ($data & 32 ? 'r' : '-') . ($data & 16 ? 'w' : '-') . ($data & 8 ? 'x' : '-');
    $world = ($data & 4 ? 'r' : '-') . ($data & 2 ? 'w' : '-') . ($data & 1 ? 'x' : '-');
    return array('codes' => $codes, 'owner' => $owner, 'group' => $group, 'world' => $world, 'octal' => str_pad(decoct($data), 4, '0', STR_PAD_LEFT), 'flags' => $codes . $owner . $group . $world);
}
xdebug_var_dump(getPermFlags(63));
Ejemplo n.º 14
0
 /**
  * // TODO implement a generic dump function.
  * @param $var
  */
 public static function dump_it_out($var)
 {
     xdebug_var_dump($var);
 }
Ejemplo n.º 15
0
 /**
  * Debug helper function.  This is a wrapper for var_dump|xdebug_var_dump that adds
  * the <pre /> tags, cleans up newlines and indents, adds file name and line number info
  * and runs htmlentities() before output.
  *
  * @param  mixed   $var        The variable to dump.
  * @param  boolean $outputDump Overrides self::$output flag
  * @return string
  */
 public function dump($var, $outputDump = null)
 {
     // add file and line on which Dump was called
     $backtrace = debug_backtrace();
     $label = 'Dump - File: ' . $backtrace[0]['file'] . ', Line: ' . $backtrace[0]['line'];
     // var_dump the variable into a buffer and keep the output
     ob_start();
     if ($this->xdebugDumpExists()) {
         xdebug_var_dump($var);
     } else {
         var_dump($var);
     }
     $output = ob_get_clean();
     // neaten the newlines and indents
     $output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
     if (static::getSapi() == 'cli') {
         $label = $label . PHP_EOL;
         $output = PHP_EOL . $label . PHP_EOL . $output . PHP_EOL;
     } else {
         $label = $label . PHP_EOL;
         $output = htmlentities($output, ENT_QUOTES, 'UTF-8');
         $output = '<pre>' . $label . $output . '</pre>';
     }
     $echo = self::$output;
     if (is_bool($outputDump)) {
         $echo = $outputDump;
     }
     if ($echo) {
         echo $output;
         if ($this->flushBuffer) {
             ob_flush();
         }
     }
     return $output;
 }
Ejemplo n.º 16
0
 /**
  * This function displays structured information about one or more expressions that includes its type and value.
  * Arrays are explored recursively with values.
  * @return void
  */
 public function varDump()
 {
     xdebug_var_dump();
 }