安装和配置 Kohana 后,我重命名了 install.php 文件(根据用户指南)。但是当我现在去 localhost/kohana 时,我收到以下错误:
ErrorException [ 8 ]: Array to string conversion ~ SYSPATH/classes/Kohana/Log/Writer.php [ 81 ]
我在网络上的其他地方找不到解决方案。有谁知道如何解决这个问题?谢谢!
这是该错误的修补程序。希望这对其他人有所帮助 https://github.com/kohana/core/commit/82b470b2827470da37b0e6771b77c369c3d2e5fb
类/Kohana/Log/Writer.php
public function format_message(array $message, $format = "time --- level: body in file:line")
{
$message['time'] = Date::formatted_time('@'.$message['time'], Log_Writer::$timestamp, Log_Writer::$timezone, TRUE);
$message['level'] = $this->_log_levels[$message['level']];
- // FIX: $message should consist of an array of strings
- $message = array_filter($message, 'is_string');
-
- $string = strtr($format, $message);
+ $string = strtr($format, array_filter($message, 'is_scalar'));
if (isset($message['additional']['exception']))
{
$message['body'] = $message['additional']['exception']->getTraceAsString();
$message['level'] = $this->_log_levels[Log_Writer::$strace_level];
- $string .= PHP_EOL.strtr($format, $message);
+ $string .= PHP_EOL.strtr($format, array_filter($message, 'is_scalar'));
}
return $string;
注意'+' 表示添加的行,'-' 表示从 v3.3 中删除的行
这是一个 Kohana 3.3 版本的错误。在这里查看更多细节。