Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Custom pages get error after upgrade to 4.0


#1

We added a custom project_stats page to our TestRail install to show various metrics in realtime.

Unfortunately, we get an error now:

Trying to get property of non-object
---
Details: <missing>
File: /var/www/testrail/app/views/layout/header.php
Line: 180
Status Code: 500
Host: testrail-mobile.host.com
Uri: /index.php?/custom/project_stats/index/3 (GET)
---
Trace:
at errors::show (errors.php:53)
at ErrorHandler::error (header.php:180)
at unknown (loader.php:195)
at Loader_core->view_abs (loader.php:168)
at Loader_core->view (index.php:16)
at unknown (loader.php:195)
at Loader_core->view_abs (loader.php:168)
at Loader_core->view (loader.php:216)
at Loader_core->page (project_stats.php:58)
at Project_stats_controller->index (controller.php:106)
at Controller->_invoke_web (controller.php:74)
at Controller->_invoke (gizmo.php:101)
at require_once (index.php:106)
---
Version: 4.0.0.3249

Can you help us figure out what we are doing wrong? I can’t inspect header.php to figure it out myself.

This is what we have in our custom page that appears to trigger the issue:

<?php
$header = array(
  'page_title' => "Project statistics ($project->name)",
  'page_section' => $project->name,
  'page_backlink' => true,
  'page_menu' => 'project',
  'page_project' => $project->id,
  'page_selected_menu' => 'metrics',
  'page_flash' => true,
  'page_breadcrumb' => array(
    'dashboard' => lang('pages_dashboard'),
    $project->name
  )
);

$GI->load->view('layout/header', $header);
?>

Thanks!


#2

Hello Logan,

Please replace:

with:

This should do the trick.

Regards,
Tobias


#3

I am currently using TestRail version 3.1.3.3146. Can you please point me to somewhere that explains/shows how to add a custom page?


#4

Hello,

We recommend using the reports feature that was introduced with TestRail 3.0 to add custom reports:

http://docs.gurock.com/testrail-custom/reports-introduction

You can alternatively also use our API to create external integrations. If you could provide a few more details on what you are trying to accomplish, we’re happy to suggest the best way to implement this (I believe we are already on contact via email, is this correct?).

Regards,
Tobias