kprint_r omits name on krumo output

danorton - June 21, 2009 - 19:56
Project:Devel
Version:6.x-1.6
Component:devel
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:krumo
Description

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().

AttachmentSize
devel.module.patch580 bytes

#1

moshe weitzman - July 1, 2009 - 23:36

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

#2

moshe weitzman - July 30, 2009 - 19:52
Status:needs review» needs work

#3

salvis - October 21, 2009 - 12:39
Status:needs work» needs review

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

<?php
     
return $return ? krumo_ob($input) : krumo($input);
?>

to

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

?

#4

moshe weitzman - October 21, 2009 - 14:18
Status:needs review» reviewed & tested by the community

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

#5

salvis - October 21, 2009 - 15:16
Status:reviewed & tested by the community» fixed

Committed to all three versions, thanks.

While looking at the D5 version I found this:

<?php
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?

#6

moshe weitzman - October 21, 2009 - 15:33

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

#7

salvis - October 21, 2009 - 15:42

Ok, done. :)

#8

System Message - November 4, 2009 - 15:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.