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
Will this work if drupal is in a subdir?
#2
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
I see that this correction has not been incorporated into devel 1.14
Hopefully it will make it into the next release?
Jonathan
#4
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
#5
forgot to change the status on the last update.
#6
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
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
Automatically closed -- issue fixed for 2 weeks with no activity.
#9
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?