This appears multiples times after images are uploaded:
Notice: Array to string conversion in drupal_send_headers() (line 1236 of /var/www/docroot/includes/bootstrap.inc).
Drupal versions affected: 7.36 / 7.38
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2482933-7.image-private-headers.patch | 480 bytes | jrb |
| field_collection_bulkupload-notices.png | 22.36 KB | dxx |
Comments
Comment #1
dxxComment #2
linucksrox commentedI just want to mention that I'm having this exact issue, but I don't use either the Bulkupload or Field Collection modules. Should this issue be reported in Drupal core (I have the issue with 7.36 and 7.37)?
Comment #3
Lycee van Gogh commentedSame problem from 7.35 to 7.37 after moving the website to a new server (PHP is now 5.5xx).
I know it is only a administrator problem but it is quite annoying !
Comment #4
pbosmans commentedSame issue here after update from php5.4 to php5.5
Comment #5
dqdconfirmed bug on D 7.38 when using private files directory as default and showing uploaded core system user pictures. So this is not a Field Collection Bulkupload issue but probably a Drupal core issue. I move this issue to D7 core file system. Feel free to change this if I am mistaken.
Comment #6
dqd... And please don't use issue tags randomly. Before adding tags read the issue tag guidelines. Thanks.
Comment #7
jrbThe notice is generated because the values of three headers (Content-Type, Content-Length, and Cache-Control) are all arrays rather than strings. In modules/image.module, the function image_style_deliver() sets the headers it will use around line 836:
If you have both the file and file_entity modules enabled, it will call the hook_file_download() implementation for each. Both of these ultimately do this:
Which returns an array:
As a result, the $headers variable isn't a simple key-value array-- module_invoke_all() creates an array with the duplicate values for each key. image.module then tries to simply loop through the headers and call drupal_add_http_header() for each one, giving the notice on each array.
A simple fix would be to just make sure that each $value is actually a string. If it's an array, we could change it to a string by just taking one of the values (the last?). This could possibly end up discarding some of the headers that are set, but I don't think it's really correct to send multiple values for these headers (which is possible by setting $append = TRUE in the call to drupal_add_http_header()).
I've attached a patch that does this.
Another solution may be to change how the file and file_entity modules work together so they don't both try to set the headers. I'm not sure how possible that would be, though.
Comment #8
marcoscanoI can confirm the issue is present with Drupal 7.39 + file_entity (7.x-2.0-beta2), when saving private field images attached to the user account.
Patch in #7 eliminates the warnings in my case.
Comment #9
mstrelan commentedI think this is a duplicate of #1891228: image_style_deliver can create invalid headers, but have not confirmed
Comment #10
linucksrox commentedUnfortunately I don't believe this is a duplicate of #1891228: image_style_deliver can create invalid headers because I'm still seeing this error consistently after having upgraded to 7.42 which includes that patch. I am also seeing the issue after having applied patch #7.
Comment #11
pflork commentedI'm still seeing this too with Drupal 7.50. Anybody else found a fix around there ?
Comment #12
staniel25 commentedA manual entry of #7 worked for me. Using 7.52. JRB, Thanks for all the work, its greatly appreciated.
Comment #13
k8e1050 commenteddrupal 7.52 patched image module on local test site in hope but no difference. Still getting Array to string conversion in drupal_send_headers multiple notices , using only attached pdf file in private upload directory. Upload is fine and viewable . Not sure if I should raise another header issue , but all similar issues seem to be related to image module, but I'm not using that module yet. Any Ideas ?
Comment #14
biigniick commentedi'm having the same issue with the file upload of an mp3 file to a file field...
drupal 7.54
media 7.x-2.3
file entity 7.x-2.0
Comment #15
ñull commentedI had the same issue. After manually applying patch #7 notices no longer appeared. I feel free to mark this reviewed and tested.
Comment #16
fonant commentedI'm getting this when generating private derived images.
The header with the array value is
Cache-controland the value is[0 => 'private', 1 => 'private'].Will report back if I have time to locate the cause.
OK, several headers have array values. I can fix the problem more robustly by adding the #7 patch method to bootstrap.inc.
Comment #17
poker10 commentedThe patch in #7 does not apply anymore. There were changes in
image_style_deliver()recently. It needs to be rerolled and verified if the issue is still present.Also it would be great to find cause of this issue in contrib modules, because Drupal core does not seems to send such headers which can cause this array to string conversion.