DevelController.php

DevelController::session() contains a theme() function that causes a function not found error on the session page ( "\devel\session" ) of the module when the module is included in Drupal 8 Beta 2. It looks to me like someone left the theme() function there because they wanted to implement fancy table formatting. But the kprint_r() function already prints out the $_SESSION array data. And you could supply session_name() and session_id() without the formatting, although I don't really know how any of this information is even especially useful


public function session() {
    $output = kprint_r($_SESSION, TRUE);
    $headers = array(t('Session name'), t('Session ID'));
    // @todo don't call theme() directly.
    $output .= theme('table', array('headers' => $headers, 'rows' => array(array(session_name(), session_id()))));  // <== ERROR HERE
    return $output;
}

So I would suggest:


public function session() {
    $output = '

Session Name: ' . session_name() . '

'; $output .= '

Session ID: ' . session_id() . '

'; $output .= '

' . t('Here are the contents of your $_SESSION variable.') . '

'; $output .= kprint_r($_SESSION, TRUE); return $output; }

Also, in conjunction with this, the devel_help() hook function in "devel.module" can be deleted, since the routing is now taken care of by the devel.routing.yml file configuration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

Status: Active » Needs review
Issue tags: +low hanging fruit
willzyx’s picture

pcambra’s picture

Status: Needs review » Fixed

Thanks, pushed to the 8.x version

  • pcambra committed 0559387 on 8.x-1.x authored by willzyx
    Issue #2367399 by pkosenko, willzyx: DevelController session() method...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.