【发布时间】:2012-01-11 23:20:40
【问题描述】:
我收到了这个奇怪的错误child pid 1789 exit signal Bus error (10) 我以前从未在我的 Apache 错误日志中看到过。我正在使用 FuelPHP 框架。网络应用程序运行良好。但是今天突然间我创建了新的控制器,它本身就是另一个控制器的副本。我复制的那个工作正常(http://localhost/myapp/admin/users),但是副本(http://localhost/myapp/admin/apartments)让我犯了那个错误?!我对此感到沮丧。
经过 3 个小时的调试,我终于找到了整个事情停止的那一行。它位于这一行if (class_exists($class)) 的Router 类的FuelPHP 核心中。 if 之前的$class 的值为Controller_Admin_Apartments,这是我添加的类,存在于我的控制器类文件夹中。
fuel/core/classes/router.php:
protected static function parse_segments($segments, $namespace = '', $module = false)
{
$temp_segments = $segments;
foreach (array_reverse($segments, true) as $key => $segment)
{
$class = $namespace.'Controller_'.\Inflector::words_to_upper(implode('_', $temp_segments));
array_pop($temp_segments);
if (class_exists($class)) // ***** HERE ERROR HAPPENS ***** //
{
return array(
'controller' => $class,
'action' => isset($segments[$key + 1]) ? $segments[$key + 1] : null,
'method_params' => array_slice($segments, $key + 2),
);
}
}
// Fall back for default module controllers
if ($module)
{
$class = $namespace.'Controller_'.$module;
if (class_exists($class))
{
return array(
'controller' => $class,
'action' => isset($segments[0]) ? $segments[0] : null,
'method_params' => array_slice($segments, 1),
);
}
}
return false;
}
FeulPHP forum 的用户指出这可能与硬件有关。但事实并非如此。我把整个东西移到另一台电脑上,仍然有同样的东西。我只是不明白。这里发生了什么?
【问题讨论】: