Apache error - child pid 1789 exit signal Bus error (10)

Primoz Rome picture Primoz Rome · Jan 12, 2012 · Viewed 11.9k times · Source

I get this strange error child pid 1789 exit signal Bus error (10) I have never seen before in my Apache error log. I am using FuelPHP framework. The web app is working fine. But suddenly today I created new controller, which itself is a copy of another controller. The one I copied from works fine (http://localhost/myapp/admin/users), but the copy (http://localhost/myapp/admin/apartments) makes me that error?! I am frustrated over this.

After 3 hours of debugging I finally found the line where the whole things stops. It is in the FuelPHP core in Router class at this line if (class_exists($class)). The $class before the if has value Controller_Admin_Apartments, which is the class I have added and exists in my controller classes folder.

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;
}

A user in FeulPHP forum noted this could be Hardware related. But it is not. I moved the whole thing to another computer and still have the same thing. I just don't get it. What is happening here?

Answer

Primoz Rome picture Primoz Rome · Jan 12, 2012

Ok shoot me. Just found the error my self. I don't know why it happens but I had a synthax error in my controller Controller_Admin_Apartments. I had this function:

public function action_delete($id = null)
{
    if (apartment = Model_Apartment::find($id))
    {
        $apartment->delete();
        Session::set_flash('success', 'Deleted apartment #'.$id);
    }
    else
    {
        Session::set_flash('error', 'Could not delete apartment #'.$id);
    }
    Response::redirect('admin/apartments');
}

Note the line: if (apartment = Model_Apartment::find($id)), where I forgot to add $ in-front of variable name. I am really surprised FulePHP framework did not alert me at this and that the only error I had was in the Apache error log :S. Strange, just strange...