|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59120 Allow for re-use of rendering functions
Submitted: 2010-03-15 21:57 UTC Modified: 2017-10-24 08:24 UTC
From: catch56 at gmail dot com Assigned:
Status: Suspended Package: xhprof (PECL)
PHP Version: 5.2.12 OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-03-15 21:57 UTC] catch56 at gmail dot com
I started work this week on integrating xhprof with Drupal's devel module -

I'd like to be able to use displayXHProfReport() to render the profile report from within Drupal (hence not requiring any setup beyond having the extension installed), but ran into issues due to amount of code depending on global scope.

If I explicitly declare the following as globals, I can get a report printed to screen:

+  global $source;
+  global $run;
+  global $wts;
+  global $symbol;
+  global $sort;
+  global $run1;
+  global $run2;
+  global $all;

However there are a tonne of notices, at least initially from the $sortable_columns global in xhprof.php.

I could probably keep going and declare all the globals which are around the script, but that's prone to breakage if something changes, so would we great to have the following:

1. Remove all globals apart from those taken from the $_GET request. Something like $sortable_columns could just be moved to a sortable_columns() helper function.

2.Less of an issue, but displayXHProfReport() could return a variable which is then printed to screen, rather than profile_report() echoing direct to screen. This would make it much more re-usable. 

Expected result:
Be able to call displayXHProfReport() and get a report back, without having to redeclare any globals (apart from those set up in xhprof_html/index.php)

Actual result:
Report renders, but notices abound.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 18:01 UTC]
-Assigned To: +Assigned To: scottmac
 [2017-10-24 06:11 UTC]
-Status: Assigned +Status: Open -Assigned To: scottmac +Assigned To:
 [2017-10-24 08:24 UTC]
-Status: Open +Status: Suspended
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 00:03:39 2021 UTC