Needs work
Project:
Apache Solr Attachments
Version:
7.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2012 at 15:10 UTC
Updated:
8 Aug 2013 at 13:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
ksavoie commentedI can second this issue except it appears within admin on every node save if a 'file' field is empty. If file field is populated then this error does not occur. If node has more than one empty 'file' field it shows that many times.
Warning: Invalid argument supplied for foreach() in apachesolr_attachments_field_attach_update() (line 472 of /var/www/html/mudomaha/sites/all/modules/apachesolr_attachments/apachesolr_attachments.module).
Version 7.x-1.2
PHP 5.3.19
Seems to be working otherwise, indexes uploaded files.
Comment #2
valdo commentedThis has been already partially fixed in the 7.x-1.x dev branch:
- the second line is the fix.
But there is also 1 more place like this that needs to be sanitized the same way - the same logic inside apachesolr_attachments_field_attach_delete().
Patch to fix this issue is attached.
Comment #3
solquimpo commentedHere's a better patch to get rid of the warnings originating from both apachesolr_attachments_field_attach_update and apachesolr_attachments_field_attach_delete.
Comment #4
solquimpo commentedHmm, something wrong with the previous patch. Attaching another one.
Comment #5
eiriksmExcept there is no new line at end of file, patch looks good to me, and fixes the issue.
This error totally breaks drush migrate imports with file fields, so would really like to see this get commited :)
Comment #6
nick_vhnickveenhof@Nick-Veenhofs-MacBook-Pro:~/Sites/dev/apachesolrissues/site/sites/all/modules/contrib/apachesolr_attachments$ git apply ~/Sites/dev/patches/apachesolr_attachments_php_warning_fix2.patch
error: patch failed: apachesolr_attachments.module:469
error: apachesolr_attachments.module: patch does not apply
It does not apply? :-/ Please reroll
Comment #7
eiriksmHey.
The patch in #4 works for 7.x-1.2. But as valdo states in #2 this issue was partly fixed in -dev. But the patch in #2 applies to -dev and fixes the issue. Sorry I did not make that clear when setting it to RTBC.
Comment #8
nick_vhThat still does not make it apply? Please reroll
Comment #9
valdo commentedNick_vh: I believe this issue can be closed, as there is nothing to fix anymore in the dev branch. It has already been fixed, this is the code I see now in the recent dev branch (7.x-1.x):
File: apachesolr_attachments.module
Line 595:
Line 627:
The conditions
if ($items)orif(!empty($items))were the parts that were missing and causing this bug.I'm not sure whether these fixes were included in the recent release already, but in the dev branch they are fixed.