SOLVED: Logger.php throws md5() token error

I’m using this code in my layout view (yii2 2.0.12):


<? $profiling = Yii::getLogger()->getDbProfiling();?>

… but it throws this exception, any idea why?

"md5() expects parameter 1 to be string, array given"

in app/vendor/yiisoft/yii2/log/Logger.php




    public function calculateTimings($messages)

    {

        $timings = [];

        $stack = [];

 

        foreach ($messages as $i => $log) {

            list($token, $level, $category, $timestamp, $traces) = $log;

            $memory = isset($log[5]) ? $log[5] : 0;

            $log[6] = $i;

            $hash = md5($token);

            if ($level == Logger::LEVEL_PROFILE_BEGIN) {

                $stack[$hash] = $log;

            } elseif ($level == Logger::LEVEL_PROFILE_END) {

                if (isset($stack[$hash])) {

                    $timings[$stack[$hash][6]] = [

                        'info' => $stack[$hash][0],

                        'category' => $stack[$hash][2],

                        'timestamp' => $stack[$hash][3],

                        'trace' => $stack[$hash][4],


2. yii\base\ErrorHandler::handleError(2, 'md5() expects parameter 1 to be ...', '...', 281, ...)



The following line is marked $hash = md5($token);

It is a bug. Fixed in master already: https://github.com/yiisoft/yii2/issues/14264

Thank you @samdark