private function traceComponentMakeSane( $trace )
    {
        // debugging wondering why some traces's don't have a args object set
        if( isset( $trace['args'] ) ) {
            $trace['args'] = array_map(
                function($arg){
                    switch(true) {
                        case is_object($arg):
                            return get_class($arg);
                        case is_bool($arg):
                            return $arg ? 'true' : 'false';
                        case is_scalar($arg):
                            return $arg;
                        default:
                            return gettype($arg);
                    }
                },
                $trace['args']
            );
        } else {
            $trace['args'] = array();
        }
        if( isset( $trace['file'] ) and false !== $pos = strpos( $trace['file'], '/Symfony/' ) ) {
            $trace['file'] = ".".substr( $trace['file'], $pos );
        }

        // set the file and line properties if they don't exist
        if( !array_key_exists( 'file', $trace ) ) {
            $trace['file'] =  null;
        }
        if( !array_key_exists( 'line', $trace ) ) {
            $trace['line'] =  null;
        }

        // attempt to add file and line back in
        // not sure why this would be required - it seems very hacky but seemingly corrects some inexplicatbly missing information
        if( !$trace['file'] and !$trace['line'] and isset( $trace['class'] ) and isset( $trace['function'] ) ) {
            try {
                $reflMethod = new \ReflectionMethod( $trace['class'], $trace['function'] );
                $trace['file'] = $reflMethod->getFileName();
                $trace['line'] = $reflMethod->getStartLine();
            } catch ( \Exception $e ) {
            }
        }

        // unset the object property - not sure why this has appeared. It wasn't present in the output of the original sane_debug_backtrace()
        unset( $trace['object'] );
        return $trace;
    }
private function traceComponentMakeSane( $trace )
    {
        // debugging wondering why some traces's don't have a args object set
        if( isset( $trace['args'] ) ) {
            $trace['args'] = array_map(
                function($arg){
                    switch(true) {
                        case is_object($arg):
                            return get_class($arg);
                        case is_bool($arg):
                            return $arg ? 'true' : 'false';
                        case is_scalar($arg):
                            return $arg;
                        default:
                            return gettype($arg);
                    }
                },
                $trace['args']
            );
        } else {
            $trace['args'] = array();
        }
        if( isset( $trace['file'] ) and false !== $pos = strpos( $trace['file'], '/Symfony/' ) ) {
            $trace['file'] = ".".substr( $trace['file'], $pos );
        }

        // set the file and line properties if they don't exist
        if( !array_key_exists( 'file', $trace ) ) {
            $trace['file'] =  null;
        }
        if( !array_key_exists( 'line', $trace ) ) {
            $trace['line'] =  null;
        }

        // attempt to add file and line back in
        // not sure why this would be required - it seems very hacky but seemingly corrects some inexplicatbly missing information
        if( !$trace['file'] and !$trace['line'] and isset( $trace['class'] ) and isset( $trace['function'] ) ) {
            try {
                $reflMethod = new \ReflectionMethod( $trace['class'], $trace['function'] );
                $trace['file'] = $reflMethod->getFileName();
                $trace['line'] = $reflMethod->getStartLine();
            } catch ( \Exception $e ) {
            }
        }

        // unset the object property - not sure why this has appeared. It wasn't present in the output of the original sane_debug_backtrace()
        unset( $trace['object'] );
        return $trace;
    }
private function traceComponentMakeSane ( $ trace ) { // debugging wondering why some traces's don't have a args object set if ( isset ( $ trace [ 'args' ] ) ) { $ trace [ 'args' ] = array_map ( function ( $ arg ) { switch ( true ) { case is_object ( $ arg ) : return get_class ( $ arg ) ; case is_bool ( $ arg ) : return $ arg ? 'true' : 'false' ; case is_scalar ( $ arg ) : return $ arg ; default : return gettype ( $ arg ) ; } } , $ trace [ 'args' ] ) ; } else { $ trace [ 'args' ] = array ( ) ; } if ( isset ( $ trace [ 'file' ] ) and false !== $ pos = strpos ( $ trace [ 'file' ] , '/Symfony/' ) ) { $ trace [ 'file' ] = "." . substr ( $ trace [ 'file' ] , $ pos ) ; } // set the file and line properties if they don't exist if ( ! array_key_exists ( 'file' , $ trace ) ) { $ trace [ 'file' ] = null ; } if ( ! array_key_exists ( 'line' , $ trace ) ) { $ trace [ 'line' ] = null ; } // attempt to add file and line back in // not sure why this would be required - it seems very hacky but seemingly corrects some inexplicatbly missing information if ( ! $ trace [ 'file' ] and ! $ trace [ 'line' ] and isset ( $ trace [ 'class' ] ) and isset ( $ trace [ 'function' ] ) ) { try { $ reflMethod = new \ ReflectionMethod ( $ trace [ 'class' ] , $ trace [ 'function' ] ) ; $ trace [ 'file' ] = $ reflMethod -> getFileName ( ) ; $ trace [ 'line' ] = $ reflMethod -> getStartLine ( ) ; } catch ( \ Exception $ e ) { } } // unset the object property - not sure why this has appeared. It wasn't present in the output of the original sane_debug_backtrace() unset ( $ trace [ 'object' ] ) ; return $ trace ; }
Format a trace into a more managable output when massive objects are involved
@param array $trace
@return array
Format a trace into a more managable output when massive objects are involved