Running core 7.26, (but also when I was running core 7.23!) am receiving the following notice:

Undefined index: file in .... sites/all/modules/devel/devel.module on line 2017.

The relevant line is:

$path = $backtrace[$counter - 1]['file'];

Any thoughts? Could it be the version of php I am running (5.4.26)? $backtrace is populated with a call to debug_backtrace() which should according to the php manual include an element with key "file". Stumped.

In case it helps, the output of $backtrace as it arrives at line 2017 is attached. I think the culprit is evident.

CommentFileSizeAuthor
#3 debug_backtrace.png52.29 KBhowwwie
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

howwwie’s picture

Issue summary: View changes
howwwie’s picture

Issue summary: View changes
howwwie’s picture

Issue summary: View changes
FileSize
52.29 KB
SocialNicheGuru’s picture

I am getting this too. php5.5

suntower’s picture

Me too. php5.5. Seems to have started after updating Commerce to latest version and core from 7.26 to 7.32... though that could be a red herring?

I'm fairly new to Drupal... workaround?

sfbob’s picture

Me too. core 7.34, php 5.2.17

kenorb’s picture

kenorb’s picture

Version: 7.x-1.4 » 7.x-1.5

Notice: Undefined index: file in devel/devel.module on line 2017

Backtrace: theme_get_setting-> backtrace_error_handler->ddebug_backtrace( $return = TRUE, $pop = -1)

Affected code:

    $path = $backtrace[$counter - 1]['file'];

Local vars:

$call =
Undefined
$counter =
int 6
$function =
Undefined
$len =
Undefined
$nbsp =
Undefined
$nicetrace =
Undefined
$options =
boolean true
$path =
Undefined
$paths =
Undefined
$pop =
int -1
$return =
boolean true
$backtrace =
array (size=6)
  0 => 
    array (size=4)
      'file' => string 'includes/theme.inc' (length=94)
      'line' => int 1476
      'function' => string 'backtrace_error_handler' (length=23)
      'args' => 
        array (size=5)
          0 => &int 8
          1 => &string 'Trying to get property of non-object' (length=36)
...
5 => 
    array (size=2)
      'function' => string '_drupal_exception_handler' (length=25)
      'args' => 
        array (size=1)
          0 => 
            object(EntityMalformedException)[2335]
              protected 'message' => string 'Missing bundle property on entity of type node.' (length=47)
              private 'string' (Exception) => string '' (length=0)
              protected 'code' => int 0
              protected 'file' => string 'includes/common.inc' (length=95)
              protected 'line' => int 7844
              private 'trace' (Exception) => 
                array (size=24)
                  0 => 
                    array (size=4)
...

So it seems 5 element from $backtrace doesn't have file key.

kenorb’s picture

Possible fix:

-$path = $backtrace[$counter - 1]['file'];
+$path = !empty($backtrace[$counter - 1]['file']) ? $backtrace[$counter - 1]['file'] : '';
salvis’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Needs work

Yes, and what about 'line'?

Patch must go against the -dev version, if the issue is still there...

Is it also in D8?

Joel MMCC’s picture

Over a year after the most recent comment prior to this one, and the problem is still happening for me (with version 7.x-1.5 — changing to the latest -dev of 2017-Jan-10 changes the line number of the error message to 1980 instead of 2017 but does nothing else to fix it).

EDIT to add: Applying @kenorb’s fix manually from #9 makes the error message go away, but no SQL queries are shown even on a page with Views output which should be loaded with them. It prevents the error message, but does not fix the underlying problem.

salvis’s picture

Status: Needs work » Fixed

Yeah, it's too bad that no one ever cared enough to post a patch.

I encountered and fixed it in #2959508: PHP 7.2 Incompatibility - count(): Parameter must be an array or an object that implements Countable in krumo::_object

Status: Fixed » Closed (fixed)

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