See: http://drupal.org/node/349408#comment-1286442
FYI: The new dev snapshot contains code for product imports (including images!), but I cannot get taxonomies to import as of yet.
I get these errors:
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* warning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
* Manufacturer (key=9, weight=0) field is required.
* Room (key=7, weight=0) field is required.
* Wood Type (key=8, weight=0) field is required.
* Category is required.Where the last four lines are Vocabularies.
Edit: I deleted my vocabularies and re-created them and the errors are no more! Since this might be a bug still I will leave my errors up.
| Comment | File | Size | Author |
|---|---|---|---|
| #46 | test_import.csv_.zip | 594 bytes | switch13 |
| #42 | attributes_example_testfile2.xls | 21.5 KB | razorback |
| #17 | rayoni.csv_.txt | 4.58 KB | lolmaus |
| #16 | unicode.inc_.issue383926.patch | 677 bytes | boaz_r |
| #3 | zip_city_county_t.txt | 402 bytes | Mac Clemmens |
Comments
Comment #1
Mac Clemmens commentedyes, I'm having the same issue. It has to do with the way the vocabulary is setup. When I switched off multiple values, and/or tried tags, and/or assigned it to only one content type then it worked (sorry it's late and I can't remember which in my desperate attempts to get it to import.) I still cannot get the parent field to import. If I do not map that field then I do not have that problem.
Comment #2
Robrecht Jacques commentedDo you have a sample file?
Comment #3
Mac Clemmens commentedYes -- it's attached. It is supposed to be a csv file but drupal won't allow that file extension to be uploaded. Would you also like the bug report?
Comment #4
Robrecht Jacques commentedYes, that's useful to know how to vocabulary is configured.
Comment #5
Mac Clemmens commentedI found this was due to the fact that the taxonomy vocabularies were not set to Free tagging vocabs. (You can switch to a free tagging vocab and then switch back.) I still can't get parent's to work, so I have to ignore that for now. I was able to just import the parent terms again and then use the synonym collapse module to merge the data. Hope this helps.
Comment #6
boaz_r commentedI've seen this issue that happens with "password_confirm" form elements, where #maxlength is defined for it. Removed the #maxlength and the issue is gone. See more here: http://drupal.org/node/378558
Comment #7
milos.kroulik commentedI have still this problem and above mentioned setting all vocalbularies to "Tags" didn't help.
I have several vocabularies, some of them already contain some terms (because I don't plan them as freetagging in the future). I am using Content Taxonomy module to fill terms to these vocabularies. When I try to import CSV file, containing values, corresponding to CCK fields (which correspond to taxonomy terms) I give this error and terms (and also fields) aren't imported.
So what am I doing wrong? Am I missing something? I am very beginner in Drupal.
Comment #8
aero530 commentedFrom what I can tell the error comes about when node_import.inc does a function call to drupal_strlen() which it does as a check to make sure all the values have some string in them (hence using a string length > 0 test). If you comment out these checks in modules/node_import/node_import.inc the taxonomy will import. To be fair, this is a bad solution (ie they put those checks in for a reason) but it worked for me.
Comment out (or delete) the following 4 lines in modules/node_import/node_import.inc
line 587: "if (drupal_strlen($values[$fieldname][$i]) > 0) {"
line 596 (this is the bracket which closes the above if statement): "}"
line 611: "if (drupal_strlen($value) > 0) {"
line 630 (this is the bracket which closes the above if statement): "}"
Comment #9
totocol commentedIm trying to import users and getting a similar message than the one in this issue.
I applied #8 solution and now I get new erros:
* warning: preg_match() expects parameter 2 to be string, array given in /home/tes17968/public_html/sites/all/modules/date/date_api_elements.inc on line 585.
* warning: array_shift() [function.array-shift]: The argument should be an array in /home/tes17968/public_html/sites/all/modules/date/date_api_elements.inc on line 586.
Any idea. Maybe I am nto saving my file correctly?
Any hlp would be really appreciated
Comment #10
milos.kroulik commentedI tried this solution and it still didn't solve my problem (errors are all the same). However, when I tried to import only terms to one vocabulary, it works. Does it work for anyone, who tries to import Content type nodes?
Comment #11
caver456 commentedsame here - no problem when just importing to one taxonomy-keyed field; the problem only shows up for me when importing multiple taxonomy-keyed fields, each using a different vocab (is there a way to make em all use the same vocab?)
Comment #12
caver456 commentedinteresting - I'm importing 4 taxonomy-keyed fields. All of the vocabularies are the same. But, on the node import step where you specify what character separates multiple values for each cell, only the last one has a field to specify characters used to indicate hierarchy (defaults to '>>'). Upon blanking this out, the mb_strlen warnings go away! Then after step 8 when it actually does the import, is says an error happened, doesn't give any detail, but the nodes are there and actually did get imported as expected.
Will search more and submit detailed info if this seems like solid info. Just a lead for the moment...
Comment #13
intedinmamma commentedThe fix in #8 worked for me. I'm importing nodes with hierarchial terms, which I assume means that the taxonomy field (from the CSV file) is split up into an array for traversing later. (explode('>>', $field), or something like that) Moving the split to after the drupal_strlen() check could fix the issue, but I'm just shooting from the hip. :)
Comment #14
zeezhao commentedsubscribing
Comment #15
okday commentedsubscribing
Comment #16
boaz_r commentedI've created the following patch. This patch is only a workaround as the bug is in the several places that call drupal_strlen with an array instead of a string.
Comment #17
lolmaus commentedGot the same problem. Trying to add taxonomy terms to certain parents.
My error looks like this:
I had got two mb_strlen() error lines there. Enabling free tagging removed one of them, but the other one persists.
None of other solutions suggested here helped. :(
#8 suggestion didn't work.
#16 caused a dozen new errors. :(
Any other ideas? :)
PS I've attached my csv file (rename it to .csv).
PPS And what's the strange set_time_limit() error?
Comment #18
boaz_r commented1. your PHP is running in "safe mode". That's a security feature. In this mode, its configured *not* to allow usage of the PHP command "set_time_limit()" and since somewhere in the code this command is used (probably during the importing task, so the importing won't fail if there's lots to import), it fails and this error is printed.
2. what errors are cause out of #16? Are you sure you patched the right file successfully?
Comment #19
Sunrises commentedHi,
1. i have created taxonomy terms(this terms are required for content) for ubercart product content type, before installing node import module
2. At this time I installed node import module and it works fine to import content as csv file format
3. Later I added a single term to the same vocabulary(say some xxxx)
4. Now the node import module could not work well and it shows the following warnings along with the vocabulary field is required
*). # warning: mb_strlen() expects parameter 1 to be string, array given in /home/.../.../www.mysite.com/includes/unicode.inc on line 404.
**). # warning: mb_strlen() expects parameter 1 to be string, array given in /home/.../..../www.mysite.com/includes/unicode.inc on line 404.
***). xxxx field is required.(xxxx->means it is vocabulary name)
is there any solution? #8 is not worked for me, my boss not interested to use patch file
please tell me how to configure taxonomy terms(please upload a detailed file, since I confused to configure taxonomy terms, I downloaded #3 attachment,but it is not clear to me)
Thank you
Comment #20
ikarusweb commentedsubscribing
Comment #21
Robrecht Jacques commentedThere were problems with hierarchical taxonomies. In D5 this was an advanced setting, but in D6 all taxonomies are hierarchically by default, so this means that importing taxonomy terms failed for all vocabularies (except the free-tagging ones).
This has now been fixed in CVS. I'll release -rc5 later today.
Comment #22
kris digital commentedAh sorry my fault! you can delete this message and mark as fixed again!!
Thanks,
Horst
Comment #23
kris digital commentedComment #24
cjdavis commentedThis is indeed fixed - I'm importing UberCart products just fine. However, updating to the newest dev version on a second copy of my site did not solve the problem. I was still getting the error on step 7, and pulling my hair out trying to get it to work.
As it happens. I double checked that 'tags' was set for my catalog taxonomy - it was. So I cleared it and hit the reload button on step 7 - and got the expected errors with the non-matching catalog fields. I set tags back on, hit reload again, and ALL of the errors and warnings went away!?! Now the import works perfectly. Perhaps the variable was corrupted in some way in the db.
Comment #25
samhodge1972 commentedSubscribing
Also see http://drupal.org/node/349408#comment-1702716
Sam
Comment #26
Zalatar commented**Subscribe**
Comment #27
domineaux commentedSubscribing
Comment #28
terryg-1 commentedSubscribing
Comment #30
Aleet commentedBlanking out the >> also made the error go away. Thank you.
Comment #31
izarco commentedI have the same problem like #19 Sunrises. Any solution?
Comment #32
jcamfield commented#12 solution worked for me; I was importing a content type and filling in two different taxonomy fields; If I only selected one - no mb_strlen errors; if two, errors on any record with values for both taxonomies. Blanking the heirarchy separator >> removed the errors - after that the import worked and the taxonomies mapped correctly!
Comment #33
vpapadim commentedgiven a similar situation with 3 vocabularies, My solution was to mark the vocabularies as free tagging.
also, once I made this change the speed of the import was 100% better.
The weird thing was that my imports were working fine to begin with (for at least 5 large cvs files) Then, I started getting the error. No change in modules or content types of vocabularies (unless I miss something)..
So I am sure the hierarchy has to do with this... ">>"
After the import I unmarked the free-tag part of the vocabularies.
Comment #34
davej commentedGot import of hierarchical vocab working by upgrading from 6.x-1.0-rc4 to 6.x-1.x-dev 2009-Apr-22 (as rc5 has not appeared yet). However it later stopped working: the option to choose hierarchy separator stopped appearing and importing this vocab no longer worked, so the import failed as this vocab is required.
Found that supported/taxonomy.inc sets:
Where $vocabulary->hierarchy comes from the vocabulary db table.
However in the db, the hierarchy field was 0 for this vocab. Presumably this was previously > 0 but got changed as a side-effect of something else - the only change we're aware of is that gmap markers were enabled for this vocab. In fact simply saving the vocab, with no changes, causes the hierarchy field to be set to 0. Testing on a vanilla site (without gmap) gave this behaviour:
(1) Create vocab: not tagging; not multiple; required. => hierarchy field = 0.
(2) Add a parent term then a child term => hierarchy field = 1.
(3) Edit & save vocab with no changes => hierarchy field = 0.
(4) Add another child term => hierarchy field = 1.
Bug in taxonomy.module? Or is the hierarchy field no longer used in any consistent way in D6? (Created issue for taxonomy.module: http://drupal.org/node/580040)
Manually setting the hierarchy field to 1 got the import working again.
Dave
Comment #35
SanDiego commentedI had the same issue. Free tagging as suggested by #5 solved it for me. Thanks.
Comment #36
rares commentedusing the latest -dev version also solved this for me. perhaps the maintainer can release the rc5 version since this is a serious enough bug? thanks in advance!
Comment #38
asanchez75 commented#8 solution worked for me
Comment #39
Alun commentedI was having this problem, switched from CSV to TSV with no string delimiters or escape characters and it worked fine.
Comment #40
Rowanw commentedThere's already a lot of workarounds in this thread, but I thought I'd add my own since it's fairly simple.
For: 6.x-1.0-rc4
If you get this error:
Category is required., all you have to do is edit the relevant vocabulary without making any changes. Now you can go back and continue the import.Worked for me at least.
Comment #41
savageanne commentedodd. I switched the taxonomy to tags:on as recommended by several above. Import worked fine. Then I switched it back to tags:off and the import STILL worked fine. This after having not worked previously. Doesn't make sense, but it works, so I'm happy.
Comment #42
razorback commentedI can still use some help. I have worked myself into circles I think.... I managed to get the import module to work for the example file once I implemented a couple fixes; however, i have moved on to uploading products and I have hit a wall. I have read this thread and a couple others and i have tried every proposed solution getting very far. Seem like every time i resolve something another issue surfaces. I now get the mb_strlen error referenced here. I have managed to get products to upload by ignoring the mb_strlen error and also by turning off taxonomy. The problem with the first option is it does not add the products to any category and the second solution causes the system to incorrectly associate the products with the categories. Can someone help me line out what I need to resolve this? Which release version/patch do i need? Are there additional "manual fixes" i'll need to make as well? I can really use some help on this one..... i am a newbie and am beating my head on the desk.
I attached my test file.
Comment #43
lolmaus commentedComment #44
davidneedhamThis is still broken on the most recent dev version, though it worked the first time I tried it. I went back and made a change to the CSV and when I tried to import it again, I get the error this thread was started with:
warning: mb_strlen() expects parameter 1 to be string, array given...I used the advice in #12 (remove the default setting for hierarchy delimiters '>>') and it does indeed work. [Note: I don't know if it's related at all, but changing the delimiter for multiple values has no effect whatsoever. Even though I remove the comma, it still takes in multiple terms if separated by a comma.]
I can't imagine what broke or what I can do to reproduce this problem, but I'm willing to try troubleshooting or provide additional data if anyone needs it. The taxonomy used doesn't even have any hierarchy, so I'm drawing a blank.
Comment #45
diogo_plta commentedReplace the function node_import_values at node_import.inc to:
It's the function upgraded in devel version. But the devel version doen't worked until now. It repeat the value of the first item when import.
Comment #46
switch13 commentedI'm using the 6.x-1.x-dev as of 2010-Apr-22 version and
Post #44 Taxonomy with no hierarchy works for me! remove the default setting for hierarchy delimiters '>>' from step 5.
Comment #47
johnking commentedwarning: mb_strlen() expects parameter 1 to be string, array given in /var/clients/client0/web22/web/includes/unicode.inc on line 404.
Anyone got this fixed? I'm getting the mb_strlen errors whenever i'm try to import Node with taxonomy that have hierarchy, like CAR>>TOYOTA, the functions did not recognize the >> .
Is there a different way to import a node with hierarchy taxonomy? I'm willing to do a fresh install. thank you
Comment #48
myregistration commentedI removed the hierarchy delimeters and it works, but I, too, would like the option to use the hierarchial feature. Anyone know how to resolve this issue? Thanks!
An update, this is not happening to me anymore when I have the hierarchial delimeters. I believe I updated the dev version of node_import 6.x-1.x-dev, maybe that's what resolved it.
Comment #49
iaugur commentedSubscribing
Note:
#1 worked for me with ubercart product import using node import.
e.g. turning off all required taxonomies and making the catalog not multiple value.
(but my products in the import file only had single catalg values - so not a help if you want to import multiple values)
Comment #50
davbre87 commentedI had the same problem (taxonomy import, multiple select, hierachical) and just changed my install to the latest dev version, 6.x-1.x-dev. I no longer get the errors and my preliminary test imports work as intended.
Comment #51
jokerejoker commentedI run the latest 6.x-1.x-dev (2010-Jul-11) and the mb_strlen error remains..
warning: mb_strlen() expects parameter 1 to be string, array given in /var/vhosts/drupal/includes/unicode.inc on line 404.I am tring to import some taxonomy but the warning only appears when I add a parent field for the taxonomy, and if I then go through with the import anyway I don't get any parents of the imported taxonomies..
Any solutions?
Comment #52
jokerejoker commentedI have located the error to line 682 in node_import.inc, but don't seems to be able to find a good way to fix the problem.. Maybe some one else have a good idea?
The problem seems to be triggered because the variable $values[$fieldname] is always a one level array and therefore needs some preprocessing..??
Comment #53
jokerejoker commentedI finally worked out a working solution for the issue..
At line 682 replace the line:
$values[$fieldname] = array_filter((array)$values[$fieldname], 'drupal_strlen');With
$values[$fieldname] = array_filter((array)$values[$fieldname][0], 'drupal_strlen');I don't know if the code covers every situation but at least it is better than the current code.. :)
Comment #54
jokerejoker commentedComment #55
jokerejoker commentedI have now worked further through with the changes that I made, and it causes more problems late in the import progress..
It seems to me that when the parent items that apply to the terms as kept as an array, and all other data types in the import is a string, and the parent-item array is passed to the 'drupal_strlen'-function and causes the problem. I have now tried to convert the array of parent-item and causes problems, i have tried just testing the content of the parent-items array and that causes problem later on in the code..
I cannot find a solution that will make it possible for me to import i taxonomy with parent items..!
Any solutions??
Comment #56
jokerejoker commentedI am setting this as a bug as I find that it is a bug in the node_import.inc file..
Comment #57
AvalancheOfLlamas commentedSub.
Comment #58
drupdawg commentedthis solution #24 seems to have worked for me, thanks cjdavis.
Comment #59
emkamau commentedWhere can we get -rc5 on Drupal.org there is only -rc4.
emk
Edited: to remove report of spurious error.
Comment #60
emkamau commented@drupdawg
Would you mind posting a snippet of the successful taxonomy csv data. Just to see how it is formatted. I'm trying the following with no joy:
"Accountant>>CPA"
">>Accountant>>CPA"
Accountant is the parent and CPA the child. What is being imported into the vocabulary is the whole string exactly as written above including the ">>".
emk
Comment #61
benone commentedyeah, ok but what about multiple values and hierarchy in the same time ?
when i change the code i can import hierarchy but only first value.
example:
Online Communities > Social Networks, Internet & Telecom > Email & Messaging
only Online Communities > Social Networks are importet properly. the second one is gone....
i use last dev. can you give me any advice ?
Comment #62
John Carbone commentedHad a (flat) required taxonomy that refused to import but switching to free-tagging for the import fixed it, and I was able to switch back after. Thanks for the tips guys!
Comment #63
vunger commentedI had the same problem. As in #24 and #41, I turned tags off, then turned them back on, and presto, it's working. It's kind of like the module only recognizes that tags are on if you set them to on _after_ the module is installed. But why would that be?
Comment #64
leenwebb commentedAny progress made on tracking down this bug? I am having the odd case where for any given row in a node import, 3 of the taxonomies work just fine but the 4th fails with the mb_strlen() error. They are all free-tagging, none are required, and I did the turn-tags-off-and-then-back-on per #63 to no avail.
Comment #65
kristi wachter commentedI just wanted to chime in and add to the several comments above that removing ">>" from the hierarchical delimiter field worked for me.
Comment #66
drummondf commentedI am getting this error for parent terms - a quick rundown of how I have this set up...
The term name is an ID number, ex. 1. This is then synonymed to a term like "Red."
Another term's name is ID number "2" and synonymed to "Burgundy" and its parent field is set to "1," in hopes that the module would automatically apply heirarchy to the process. Can anyone provide me with a suggestion to get this functioning properly?