I have File entity module installed and I have images stored as private files. When Drupal attempts to create image style variants of these images then I receive the following error:
Notice: Array to string conversion in drupal_send_headers() (line 1220 of /home/johnny/workspace/quadrupal7/includes/bootstrap.inc).
This is caused because both the file.module and the file_entity.module return the same headers in their hook_file_download. In file.inc in the file_download function an array_merge is used such that the "headers" stay correct. image.module uses a module_invoke_all which uses an array_merge_recursive resulting in that duplicate headers are turned into arrays which causes above error.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2151387-imagestyledelivery-1.patch | 2.61 KB | Johnny vd Laar |
Comments
Comment #1
Johnny vd Laar commentedI'm in the process of creating a patch for this that adds a helper function that both file_download and image_style_deliver can use.
Comment #2
Johnny vd Laar commentedComment #3
Johnny vd Laar commentedComment #4
rudiedirkx commentedYou left
in
image_style_deliver(). It'll never be-1, because that's now handled byfile_download_headers().Comment #5
irishdan commentedI also had the same issue. The patch appears to have worked for me. RTBC?
dan
Comment #6
mindgame commentedIt also happens when IMCE is installed.
In module_invoke_all(), image_file_download() returns:
and imce_file_download() returns:
which are incorrectly merged to:
causing the above mentioned PHP notice.
Using array_merge instead of array_merge_recursive would result in:
All header names being converted to lowercase in drupal_send_headers() anyway.
Comment #7
tobiasb