Calling kprint_r() only dumps the structure and ignores the name parameter when using krumo.

This patch outputs the name using dprint_r() before calling krumo().

CommentFileSizeAuthor
devel.module.patch580 bytesDaniel Norton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

looked at the patch and it seems a bit more complex than what i expected. can it be simplified?

moshe weitzman’s picture

Status: Needs review » Needs work
salvis’s picture

Status: Needs work » Needs review

This bothers me, too. Can't we just change

      return $return ? krumo_ob($input) : krumo($input);

to

      return $return ? (isset($name) ? $name .' => ' : '') . krumo_ob($input) : krumo($input);

?

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

looks fine to me. you may commit this, salvis. my checkout is in flux right now.

salvis’s picture

Status: Reviewed & tested by the community » Fixed

Committed to all three versions, thanks.

While looking at the D5 version I found this:

function kprint_r($input, $return = FALSE, $name = NULL, $function = 'print_r') {
  if (has_krumo()) {
    if (user_access('access devel information')) {
      return $return ? (isset($name) ? $name .' => ' : '') . krumo_ob($input) : krumo($input);
    }
  }
  else {
    return dprint_r($input, $return, $name, 'print_r');
  }
}

'print_r' at the bottom is hard-coded rather than using $function. This is unchanged from the original patch that introduced the function in #232570: Krumo Devel 5.x backport. It was fixed for D6 in #260197: Typo in kprint_r, but not for D5. Shall I fix it?

moshe weitzman’s picture

Sure, fix for d5. you can do whatever you want with that branch. its dead to me :)

salvis’s picture

Ok, done. :)

Status: Fixed » Closed (fixed)
Issue tags: -krumo

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