View Issue Details

IDProjectCategoryView StatusLast Update
0012206phplist applicationSubscriber Importpublic29-04-11 14:59
Reporterpremax 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.10.5 
Target Version2.10.13Fixed in Version2.10.14 
Summary0012206: incorrect import of checkboxgroup attributes
DescriptionThis is issue from all versions of phplist, the bug is in import1.php, checked also the newest one from cvs.

The thing is that email import with the same values for attributes does not work for attributes of type checkboxgroup. This type of attribute is an array if fact and phplist tries to deal with it like a linear variable. So du to import phplist inserts such values to the phplist_user_user_attribute table:

select * from phplist_user_user_attribute;

attributeid | userid | value
 1 | 1 | Array
 1 | 2 | Array
 1 | 3 | Array
 1 | 4 | Array

Attribute of id 1 is checkgroupbox. In the result, no values for checkgroupboxes are set during import. Also, the error "Database error 1054 while doing query Unknown column 'Array' in 'where clause'" shows up in several places.

The fix:
 find the following lines in the file admin/import1.php (lines 222-224 in rev 1.14 8/2/2007 from cvs):

while (list($attr,$value) = each($attributes))
 Sql_query(sprintf('replace into %s (attributeid,userid,value)
 values("%s","%s","%s")',
 $tables["user_attribute"],$attr,$userid,addslashes($value))
 );

and replace them with:

while (list($attr,$value) = each($attributes))
{
 if(is_array($value))
    $value=implode(',',$value);
 Sql_query(sprintf('replace into %s (attributeid,userid,value)
 values("%s","%s","%s")',
 $tables["user_attribute"],$attr,$userid,addslashes($value)));
}

So the fix is to check if attribute is an array or not, and deal with this.
Works for me :]

TagsNo tags attached.

Relationships

related to 0003721 closed phplist application phplist 2.10.x 
related to 0004722 assignedmichiel phpList plugins Selection criteria problem with checkbox attribute. 
related to 0005921 closeduser1822 phplist application selecting values in checkbox attribute during import doesn't work 
related to 0015421 resolvedmichiel phplist application Importing CSV with multiple values for Checkboxgroup crashes with SQL Error 

Activities

05-11-07 18:27

 

import1.php (15,000 bytes)

user1308

05-11-07 19:49

  ~0035744

Thanks will check fix in next release and maybe add it to the code

michiel

29-04-11 14:59

manager   ~0051206

http://phplist.svn.sourceforge.net/phplist/?rev=2672&view=rev