( ! ) Fatal error: Call to undefined function decode_entities() in /var/www/drupal7x/includes/common.inc on line 1552

Call Stack
# Time Memory Function Location
1 0.0000 60076 {main}( ) ../index.php:0
2 0.0006 109736 drupal_bootstrap( ) ../index.php:21
3 0.0102 608372 _drupal_bootstrap_page_header( ) ../bootstrap.inc:2047
4 0.0102 608444 bootstrap_invoke_all( ) ../bootstrap.inc:2270
5 0.0105 608976 module_invoke( ) ../bootstrap.inc:905
6 0.0105 609592 call_user_func_array ( ) ../module.inc:793
7 0.0105 609908 devel_boot( ) ../module.inc:0
8 0.0105 609908 devel_xhprof_enable( ) ../devel.module:571
9 0.0106 611336 _drupal_error_handler( ) ../bootstrap.inc:0
10 0.0107 612340 _drupal_error_handler_real( ) ../bootstrap.inc:2095
11 0.0347 1908404 filter_xss_admin( ) ../errors.inc:82
12 0.0347 1915756 filter_xss( ) ../common.inc:1295
13 0.0350 1922680 preg_replace_callback ( ) ../common.inc:1356
14 0.0350 1924072 _filter_xss_split( ) ../common.inc:0
15 0.0351 1926064 _filter_xss_attributes( ) ../common.inc:1423
16 0.0354 1927580 filter_xss_bad_protocol( ) ../common.inc:1488

reproduce
1. download and enable devel-7-dev
2. set a wrong path to xhprof
3. save conf

** It said in common.inc on line 1552 , so I think this is a core issue.

CommentFileSizeAuthor
#4 de_4.patch574 bytesStevel
#2 de.patch576 bytesdroplet
de.patch516 bytesdroplet

Comments

salvis’s picture

Status: Active » Needs review

We have two issues here:

1. In Devel's

function devel_xhprof_enable() {
  if (devel_xhprof_is_enabled()) {
    if ($path = variable_get('devel_xhprof_directory', '')) {
      include_once $path . '/xhprof_lib/utils/xhprof_lib.php';
      include_once $path . '/xhprof_lib/utils/xhprof_runs.php';
      // @todo: consider a variable per-flag instead.
      xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
    }
  }
}

there could be some error checking.

2. The core error handler should be able to handle errors during hook_boot() without tripping over the missing decode_entities().

The error message, if we'd actually get to see it, might be good enough that #1 is ok as it is, so let's fix #2 first.

require_once is inefficient. We should at least wrap this in if (!function_exists ('decode_entities')).

I'm still setting this to 'needs review' in order to get some feedback whether this is the right approach.

droplet’s picture

StatusFileSize
new576 bytes

added function_exists check

moshe weitzman’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Looks proper to me.

Stevel’s picture

StatusFileSize
new574 bytes

This is the same patch, I only removed the trailing whitespace, so leaving as RTBC.

Status: Reviewed & tested by the community » Needs work
Issue tags: -Quick fix

The last submitted patch, de_4.patch, failed testing.

Stevel’s picture

Status: Needs work » Needs review
Issue tags: +Quick fix

#4: de_4.patch queued for re-testing.

Test failures make no sens. The include should even never happen in the current test coverage, otherwise, tests should have been failing before. So this is patch is a no-op as far as the tests are concerned.

Stevel’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC as per #3.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Yeah, one of the test bots appears to be on crack again.

Committed to HEAD. Thanks!

salvis’s picture

Thanks all!

@droplet: Now what is the error message that you get from Devel (#1.1)? If we stilll need to do something there then please open a new follow-up issue in the Devel queue and link there.

Oh, and BTW, have you tried Devel's own Backtrace error handler? It should work from hook_boot(), too, or course...

droplet’s picture

@salvis

created a new issue for devel XHProf issue
#1012562: add XHProf path checks

(ya, Ive tried Devel backtrace, I'm still learning debug skills, thanks for the tips :).

salvis’s picture

(That wasn't intended so much as a hint but rather as a question whether Devel's Backtrace error handler needed fixing, too, when it's called in the same situation. IOW, does it have the same bug that you just fixed in core?)

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

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