Error in defining background gif in Krumo

jonathan1055 - January 4, 2009 - 15:45
Project:Devel
Version:6.x-1.14
Component:devel
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Within devel/krumo/class.krumo.php the function _css() defines the css code to be sent to the generated page. The variable $css_url is used when setting the background gif and defined by

<?php
   $css_url
= url(drupal_get_path('module', 'devel')) . "/krumo/skins/{$skin}/";
?>

This is incorrect as it produces in the final output the string
  background: url(/?q=sites/all/modules/devel/krumo/skins/default/bg.gif);

which does not work. The css path needs to be the simple directory path from the site root. The /?q= is not needed, and causes the file to not be found (look at the admin log to see the 'file not found' messages).

The correction is very simple, just remove the call to url( ) in the definition of $css_url, ie

<?php
   $css_url
= drupal_get_path('module', 'devel') . "/krumo/skins/{$skin}/";
?>

This produces exactly what is needed, ie the generated output is now:
  background: url(sites/all/modules/devel/krumo/skins/default/bg.gif);

The images now show up and there is no log entry for files not found.

Can this fix be incorporated into your next release?

#1

moshe weitzman - January 20, 2009 - 04:22
Status:active» postponed (maintainer needs more info)

Will this work if drupal is in a subdir?

#2

jonathan1055 - January 20, 2009 - 10:43

Yes I think it will. drupal_get_path() will return the directory path starting from where the drupal mainpage (index.php) is installed. So whereever that is, it should give the correct path from there to the devel module. What we don't need is the url() function added on top of that, because that is used to make a clickable link (by adding ?q= for those who do not have clean urls installed). I am guessing that the module developer had clean-urls active, so did not notice the problem, because no ?q= would have been added.

#3

jonathan1055 - February 17, 2009 - 15:18

I see that this correction has not been incorporated into devel 1.14
Hopefully it will make it into the next release?

Jonathan

#4

jonathan1055 - March 18, 2009 - 14:59
Version:6.x-1.13» 6.x-1.14

Here is a patch for the change. It was made from the /devel/ directory, which I think is what is required. It is my first patch, so let me know how you get on. Took me a while to realise that I had to apply it using the -p0 option, because the file to be changed is in a sub-directory.

I can't be the only person using devel without clean urls and who does not want to see this warning written to the log on every use. So if anyone uses this patch please let us know here.

Jonathan

AttachmentSizeStatusTest resultOperations
_devel.css_url.patch.txt475 bytesIgnoredNoneNone

#5

jonathan1055 - March 26, 2009 - 21:26
Status:postponed (maintainer needs more info)» needs review

forgot to change the status on the last update.

#6

mvc - September 18, 2009 - 16:04
Status:needs review» reviewed & tested by the community

Works perfectly for me with and without clean URLs. Thanks!

Edit: I forgot to mention that without this patch the image is broken on multilingual sites using language switching by path prefix.

#7

Dave Reid - September 23, 2009 - 18:17
Status:reviewed & tested by the community» fixed

Actually the preferred method is to use:
D7: file_create_url(drupal_get_path('module', 'devel') . "/krumo/skins/{$skin}/");
D6: base_path() . drupal_get_path('module', 'devel') . "/krumo/skins/{$skin}/";

Commited this to both branches.

#8

System Message - October 7, 2009 - 18:20
Status:fixed» closed

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

#9

tuttkul - November 2, 2009 - 00:40

I have a similar problem. In "Reports - Top 'page not found' errors" I have en entry like this:

sites/all/modules/devel/krumo/skins/default/%url%bg.gif

Any ideas?

 
 

Drupal is a registered trademark of Dries Buytaert.