I got the following errors:

    Warning: Invalid argument supplied for foreach() in xhprof_compute_inclusive_times() (line 1670 of /DRUPAL7/sites/all/modules/contrib/XHProf/xhprof.inc).
    Warning: Invalid argument supplied for foreach() in xhprof_compute_flat_info() (line 1644 of /DRUPAL7/sites/all/modules/contrib/XHProf/xhprof.inc).
    Warning: Invalid argument supplied for foreach() in theme_xhprof_overall_summary() (line 367 of /DRUPAL7/sites/all/modules/contrib/XHProf/xhprof.module).

Comments

erikwebb’s picture

Would you mind re-trying with the 7.x-1.x-dev version? It may still be a problem, but there has been a lot that has changed since then.

Sinan Erdem’s picture

I am using the latest dev version, but also getting the same errors when I click on the "XHProf output" link at the bottom of a page.

Warning: Invalid argument supplied for foreach() in xhprof_compute_inclusive_times() (line 1670 of /mysite/sites/all/modules/XHProf/xhprof.inc).
Warning: Invalid argument supplied for foreach() in xhprof_compute_flat_info() (line 1644 of /mysite/sites/all/modules/XHProf/xhprof.inc).
Warning: Invalid argument supplied for foreach() in theme_xhprof_overall_summary() (line 408 of /mysite/sites/all/modules/XHProf/xhprof.module).

mgifford’s picture

Thanks Sinan. I have been really swamped the last couple weeks.

erikwebb’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Sinan Erdem’s picture

Not related with this module but I ended up using xdebug. Basicly i installed xdebug on my linux server. It produces a grind file for every page request in /tmp directory. Then I downloaded and extracted Webgrind under my site root. when i go to mysite.com/webgrind in a browser, it detects those grind files and shows you a nice summary of executed functions.

Loucou’s picture

I got the same warning, with drupal 7, using the module xhprof.
I found that the origin of the issue is because Drupal/xhprof cannot write into the output directory of xhprof (php).
Usually this directory is defined by the variable "xhprof.output_dir" from a php.ini file.
I've chmod the directory with full access for all (should be more restrictive certainly).
After that, the module works without messages and reports are produced.

Hope it will help.

erikwebb’s picture

@Loucou - That is also being addressed in #1377792: Runs not saved when xhprof.output_dir set to non-existant directory, so maybe this is a duplicate.

@Sinan Erdem or @mgifford - Does this also fix the warnings for you?

Sinan Erdem’s picture

erikwebb, I dont have an installation currently on any of my websites. I cannot test unfortunately.

Ace Cooper’s picture

Status: Closed (duplicate) » Active

I found a solution for the xhprof.inc errors with my setup (click).
I'm running Drupal 7.18 on nginx 1.3.3 under CentOS 6.2 x64.
I've installed the xhprof via pear and set the xhprof.output_dir to a folder, which I deleted later.
As soon as I restored the folder - the module worked perfectly (click).

So after installing xhprof:
- check your /etc/php.d/xhprof.ini or /etc/php.ini;
- set the xhprof.output_dir correctly;
- make sure the folder permissions allow your webserver user to write there.

erikwebb’s picture

Status: Active » Closed (duplicate)

So it does sound like an issue with #1377792: Runs not saved when xhprof.output_dir set to non-existant directory. I'm marking this as a duplicate for now. If anyone else finds a case where these errors pop up, but it's unrelated to the output_dir setting, we can re-open this.

Status: Active » Closed (duplicate)