Using MAMP with PHP 5.2, there is a bug when setting a custom image (or favicon) for a theme.
To reproduce:
Go to theme-specific Appearance Settings (For Bartik: admin/appearance/settings/bartik)
Under Logo Image Settings, uncheck "Use the default logo"
Upload a custom image ("Upload logo image")
Click "Save configuration" twice (either right away, or at any other time without changing the image settings)
Expected result:
Custom image as the logo, with a url of "example.com/sites/default/files/FILENAME"
Actual result:
No image, the img tag still exists, but with a url of "example.com/FILENAME"
Cause:
The changes to drupal_realpath() from #700160: drupal_realpath does not always work as expected are only partially correct. In PHP5.2, realpath() on BSD does not return FALSE if the path does not exist, not just if !empty(path).
I've opened this against _system_theme_settings_validate_path() because that's how I found the bug, but this is really an issue with drupal_realpath() itself.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | drupal-924396-5.patch | 562 bytes | tim.plunkett |
| #1 | drupal-924396-1.patch | 722 bytes | tim.plunkett |
Comments
Comment #1
tim.plunkettchx suggested file_exists().
I'm pretty sure there is a way to do this without two calls to drupal_realpath(), but I can't figure out how to do it without PHP notices. I'm still new, don't bite!
Comment #2
tim.plunkettPatch still applies, not sure if this is really still needed.
Comment #3
sunI think we need to omit the drupal_realpath() in the second condition, because $path may be a stream wrapper URI (e.g., flickr://logo.png)
5 days to next Drupal core point release.
Comment #4
sun#1376166: Custom logo and favicon functionality inanely tries to support absolute local file paths will likely make this issue obsolete.
Comment #5
tim.plunkettThat other issue resolved this for D8, and it doesn't support 5.2 anyway.