• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed vBulletin - Import Custom User Fields - Invalid argument supplied for foreach()

#1
Hello,

When I try to import custom user fields from vBulletin 4.2 I get the following error:

Code:
Server Error

Invalid argument supplied for foreach()

XenForo_Application::handlePhpError() in XenForo/Importer/vBulletin.php at line 692
XenForo_Importer_vBulletin->_convertUserFieldChoices() in XenForo/Importer/vBulletin.php at line 584
XenForo_Importer_vBulletin->stepUserFields() in XenForo/Importer/Abstract.php at line 77
XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 195
XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 247
XenForo_ControllerAdmin_Import->_startStep() in XenForo/ControllerAdmin/Import.php at line 190
XenForo_ControllerAdmin_Import->actionStartStep() in XenForo/FrontController.php at line 337
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
XenForo_FrontController->run() in /nfs/c10/h04/mnt/175952/domains/fisiozone.pt/html/admin.php at line 13
In the Admin Log all it says is
Code:
array(1) {
["step_userFields"] => string(25) "Import Custom User Fields"
}
Thank you for helping!
 

Mike

XenForo developer
Staff member
#2
I'm not sure why this is happening. This seems to indicate a successful unserialize, but not to an array. I've added a protection to deal with this case.

I would look in vB for a "choice" field (radio, checkbox, select), perhaps one that doesn't have any choices. You should just be able to edit the choices for it or remove the field.
 
#3
Thanks Mike, however all my choice fields have options. I have a Multiple-Selection Menu and a Single-Selection Menu, I have a feeling the problem is in the Multiple-Selection Menu because you've got to click on a button to modify the fields.

Not sure how to get around this.
 

Mike

XenForo developer
Staff member
#4
Try taking one of your choice fields and tweaking one of the options, saving, untweak and save again.

Alternatively -- although I believe the code already handles this -- do any of your profile fields use accented characters? This could be an indication that you need to specify a character set (or not, if you are) when setting up the importer.

If you could export the data from the vB "profilefield" table, I can probably be more specific.
 
#5
Mike, I'm not sure what you mean by tweaking one of the options. Also, not sure how to specify a character set when setting up the importer.

Here is the dump of the table "profilefield", hopefully you will be able to see what is happening.

Code:
--
-- Dumping data for table `profilefield`
--

INSERT INTO `profilefield` (`profilefieldid`, `required`, `hidden`, `maxlength`, `size`, `displayorder`, `editable`, `type`, `data`, `height`, `def`, `optional`, `searchable`, `memberlist`, `regex`, `form`, `html`, `perline`, `profilefieldcategoryid`) VALUES
(1, 1, 0, 16384, 50, 1, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(2, 1, 0, 100, 25, 2, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(3, 2, 0, 100, 25, 3, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(7, 2, 1, 100, 25, 7, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(5, 2, 1, 100, 25, 6, 1, 'input', '', 0, 0, 0, 1, 0, '', 0, 0, 0, 0),
(6, 1, 0, 250, 0, 4, 1, 'select_multiple', 'a:13:{i:0;s:14:"Fisioterapeuta";i:1;s:22:"Estudante Fisioterapia";i:2;s:24:"Auxiliar de Fisioterapia";i:3;s:21:"Terapeuta Ocupacional";i:4;s:17:"Terapeuta da Fala";i:5;s:6:"Médico";i:6;s:10:"Enfermeiro";i:7;s:15:"Educação Física";i:8;s:27:"Outro Profissional de Saúde";i:9;s:18:"Clínica | Gabinete";i:10;s:7:"Empresa";i:11;s:8:"Paciente";i:12;s:9:"Visitante";}', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(8, 2, 1, 100, 25, 8, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(9, 2, 1, 100, 25, 9, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(10, 2, 1, 100, 25, 10, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(11, 2, 0, 100, 25, 5, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(13, 1, 0, 100, 25, 12, 1, 'select', 'a:194:{i:0;s:8:"portugal";i:1;s:6:"brazil";i:2;s:11:"afghanistan";i:3;s:7:"albania";i:4;s:7:"algeria";i:5;s:7:"andorra";i:6;s:6:"angola";i:7;s:15:"antigua barbuda";i:8;s:9:"argentina";i:9;s:7:"armenia";i:10;s:9:"australia";i:11;s:7:"austria";i:12;s:10:"azerbaijan";i:13;s:7:"bahamas";i:14;s:7:"bahrain";i:15;s:10:"bangladesh";i:16;s:8:"barbados";i:17;s:7:"belarus";i:18;s:7:"belgium";i:19;s:6:"belize";i:20;s:5:"benin";i:21;s:6:"bhutan";i:22;s:7:"bolivia";i:23;s:18:"bosnia herzegovina";i:24;s:8:"botswana";i:25;s:6:"brunei";i:26;s:8:"bulgaria";i:27;s:11:"burkinafaso";i:28;s:5:"burma";i:29;s:6:"burund";i:30;s:10:"cabo verde";i:31;s:8:"cambodia";i:32;s:8:"cameroon";i:33;s:6:"canada";i:34;s:19:"central african rep";i:35;s:4:"chad";i:36;s:5:"chile";i:37;s:5:"china";i:38;s:8:"columbia";i:39;s:7:"comoros";i:40;s:5:"congo";i:41;s:9:"costarica";i:42;s:7:"croatia";i:43;s:4:"cuba";i:44;s:6:"cyprus";i:45;s:14:"czech republic";i:46;s:13:"dem rep congo";i:47;s:7:"denmark";i:48;s:9:"djiboutil";i:49;s:8:"dominica";i:50;s:13:"dominican rep";i:51;s:7:"ecuador";i:52;s:5:"egypt";i:53;s:10:"el salvado";i:54;s:7:"england";i:55;s:9:"eq guinea";i:56;s:7:"eritrea";i:57;s:7:"estonia";i:58;s:8:"ethiopia";i:59;s:4:"fiji";i:60;s:7:"finland";i:61;s:6:"france";i:62;s:5:"gabon";i:63;s:6:"gambia";i:64;s:7:"georgia";i:65;s:7:"germany";i:66;s:5:"ghana";i:67;s:6:"greece";i:68;s:7:"grenada";i:69;s:10:"grenadines";i:70;s:9:"guatemala";i:71;s:13:"guinea bissau";i:72;s:7:"guineal";i:73;s:6:"guyana";i:74;s:5:"haiti";i:75;s:8:"honduras";i:76;s:9:"hong kong";i:77;s:7:"hungary";i:78;s:7:"iceland";i:79;s:5:"india";i:80;s:9:"indonesia";i:81;s:4:"iran";i:82;s:4:"iraq";i:83;s:7:"ireland";i:84;s:6:"israel";i:85;s:5:"italy";i:86;s:11:"ivory coast";i:87;s:7:"jamaica";i:88;s:5:"japan";i:89;s:6:"jordan";i:90;s:10:"kazakhstan";i:91;s:5:"kenya";i:92;s:8:"kiribati";i:93;s:6:"kuwait";i:94;s:10:"kyrgyzstan";i:95;s:4:"laos";i:96;s:6:"latvia";i:97;s:7:"lebanon";i:98;s:7:"liberia";i:99;s:5:"libya";i:100;s:13:"liechtenstein";i:101;s:9:"lithuania";i:102;s:10:"luxembourg";i:103;s:9:"macadonia";i:104;s:5:"macau";i:105;s:10:"madagascar";i:106;s:6:"malawi";i:107;s:8:"malaysia";i:108;s:8:"maldives";i:109;s:4:"mali";i:110;s:5:"malta";i:111;s:10:"mauritania";i:112;s:9:"mauritius";i:113;s:6:"mexico";i:114;s:10:"micronesia";i:115;s:7:"moldova";i:116;s:6:"monaco";i:117;s:8:"mongolia";i:118;s:7:"morocco";i:119;s:10:"mozambique";i:120;s:7:"namibia";i:121;s:5:"nauru";i:122;s:5:"nepal";i:123;s:13:"neth antilles";i:124;s:11:"netherlands";i:125;s:10:"newzealand";i:126;s:9:"nicaragua";i:127;s:5:"niger";i:128;s:7:"nigeria";i:129;s:11:"north korea";i:130;s:6:"norway";i:131;s:4:"oman";i:132;s:8:"pakistan";i:133;s:6:"panama";i:134;s:16:"papua new guinea";i:135;s:8:"paraguay";i:136;s:4:"peru";i:137;s:11:"philippines";i:138;s:6:"poland";i:139;s:11:"puerto rico";i:140;s:5:"qatar";i:141;s:7:"rawanda";i:142;s:7:"romania";i:143;s:6:"russia";i:144;s:8:"sao tome";i:145;s:12:"saudi arabia";i:146;s:7:"senegal";i:147;s:6:"serbia";i:148;s:10:"seychelles";i:149;s:12:"sierra leone";i:150;s:9:"singapore";i:151;s:8:"slovakia";i:152;s:8:"slovenia";i:153;s:15:"soloman islands";i:154;s:7:"somalia";i:155;s:12:"south africa";i:156;s:11:"south korea";i:157;s:5:"spain";i:158;s:8:"srilanka";i:159;s:14:"st kitts nevis";i:160;s:8:"st lucia";i:161;s:5:"sudan";i:162;s:8:"suriname";i:163;s:6:"sweden";i:164;s:11:"switzerland";i:165;s:5:"syria";i:166;s:6:"taiwan";i:167;s:10:"tajikistan";i:168;s:8:"tanzania";i:169;s:8:"thailand";i:170;s:4:"togo";i:171;s:5:"tonga";i:172;s:19:"trinidad and tobago";i:173;s:7:"tunisia";i:174;s:6:"turkey";i:175;s:12:"turkmenistan";i:176;s:6:"tuvala";i:177;s:3:"uae";i:178;s:6:"uganda";i:179;s:2:"uk";i:180;s:7:"ukraine";i:181;s:7:"uruguay";i:182;s:3:"usa";i:183;s:4:"ussr";i:184;s:10:"uzbekistan";i:185;s:7:"vanuatu";i:186;s:9:"venezuela";i:187;s:7:"vietnam";i:188;s:13:"western samoa";i:189;s:5:"yeman";i:190;s:10:"yugoslavia";i:191;s:5:"zaire";i:192;s:6:"zambia";i:193;s:8:"zimbabwe";}', 0, 0, 0, 1, 1, '', 0, 0, 0, 0),
(14, 2, 0, 100, 25, 12, 1, 'input', '', 0, 0, 0, 1, 1, '', 0, 0, 0, 0);
 

Mike

XenForo developer
Staff member
#6
Yeah, it looks like it might be the accents causing a failed unserialize. That looks like the character set thing.

You'll need to restart the import to do this (and usually you will want to re-install, though in this case you're quite early in the import so it might not be a huge deal). When you are entering your database details to start the import, use the "force character set" option and enter "latin1". Does that help?