php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: catch56 at gmail dot com
New email:
PHP Version: OS:

 

 [2010-03-15 21:57 UTC] catch56 at gmail dot com
Description:
------------
I started work this week on integrating xhprof with Drupal's devel module - http://drupal.org/node/742788

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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 18:01 UTC] sixd@php.net
-Assigned To: +Assigned To: scottmac
 [2017-10-24 06:11 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: scottmac +Assigned To:
 [2017-10-24 08:24 UTC] kalle@php.net
-Status: Open +Status: Suspended
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC