array_keys invalid argument on addresses_cck.module line 15

abaddon - September 27, 2009 - 12:20
Project:Addresses
Version:6.x-1.05
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

any idea about the below?

array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in addresses/addresses_cck/addresses_cck.module on line 15.
Invalid argument supplied for foreach() in addresses/addresses_cck/addresses_cck.module on line 15.

the function addresses_cck_content_is_empty() is called 2 times when i create a new node, $field is an array at the first call but its a string at the second call containing my field name as in "field_...", hence the error, $items is the same both times, containing the active fields for the cck address field, i just hide address name and primary address checkbox, and fax, the rest are "normal"

one other thing ive noticed is that fax always resets to "normal" on the configuration screen after im hiding it with "none", but its just the config window and im taking care to set it back to none if i modify anything, but i guess this should be a separate bug submission..

#1

xqbzzr - November 9, 2009 - 19:28

Subscribe!
Same problem here.

#2

kcybulski - November 30, 2009 - 09:26

Replace function addresses_cck_content_is_empty() in addresses_cck.module by this code, it will fix this problem :

function addresses_cck_content_is_empty($item, $field) {
if (is_array($field['columns'])) {
foreach(array_keys($field['columns']) as $ftype) {
if (!empty($item[$ftype])) {
return FALSE;
}
}}
return TRUE;
}

Are you using path on cck module that make it show only one empty field ?

Chris

 
 

Drupal is a registered trademark of Dries Buytaert.