To reproduce this error
- Create an cck image field for the page content type
- Create a different cck image field for the story content type.
- Enable seo checking for either story or page and create an instance
- You will get the invalid arguement foreach error plus a divide by zero error.
The cause of this is in the basic_seo_rules_alt_attribute function. At the top of the function (line 47 of basic_seo_rules_module) it retreives the cck field for the current content type by calling
$fields = content_fields(NULL, $form_values['type']);
However the content_fields function will return all fields for all content types when the first arguement is null. Thus we try to verify the 2 different image fields when we only have data for one of them.
To just get the fields for the current content type the above line should be replaced by
$content_info = content_types($form_values['type']);
$fields = $content_info['fields'];
Comments
Comment #1
miruoss commentedHi there,
Thanks a lot for this very clear report. I could successfully reproduce the bug and the solution you provide makes sense and works well. It has been committed to 6.x-1.x-dev for now.
Thanks,
Michael
Comment #2
miruoss commented