Active
Project:
Node import
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 May 2009 at 22:35 UTC
Updated:
6 Jun 2011 at 02:45 UTC
Import is successful & content type created but all CCK fields blank.
Isolated very simple test case with only text fields:
Member Name,title,Member Name Abbreviation
"Dedicon, lectuur en informatie","Dedicon Netherlands","Dedicon"
"Swedish DAISY Consortium","Swedish DAISY Consortium","SEDC"
Log:
Type php
Date Friday, May 15, 2009 - 16:01
Location http://www.digitaltalkingbook.com/d/admin/content/node_import/10/continue
Referrer http://www.digitaltalkingbook.com/d/admin/content/node_import/10
Message mysqli_real_escape_string() expects parameter 2 to be string, array given in /home/digitbg5/public_html/d/includes/database.mysqli.inc on line 323.
Severity error
| Comment | File | Size | Author |
|---|---|---|---|
| node_import-node_member-10.txt | 81.16 KB | k8 |
Comments
Comment #1
ncameron commentedHaving the same problem. Date, taxonomy and body fields are all fine, but CCK text fields are coming up blank
Comment #2
ncameron commentedI was going to have a crack at debugging this, but not quite sure where to start as I am unsure of the overall architecture of the code and modules.
It looks like a call to the function db_escape_string() which is causing the problem. My question is where is this being called from?
We need to a lot importing fairly urgently, so I'm willing to help as much as possible.
Thanks,
Neil
Comment #3
ncameron commentedWe were desperate to get this working at all costs and came up with this work around. Please read the disclaimer below:
****** IMPORTANT ********
This work around is not just hacky but damn right dangerous. It disables a crucial function which helps to stop XSS attacks. If you do use this please:
- Only use it to import data you are 100% sure has no XSS attacks (if you don't know what this is, find out)
- As soon as you finish importing, revert to the original file.
*************************
OK, lets get cracking.
In includes/database.mysql.inc on line 332 replace:
with
Run the import.
Revert the original file.
I can't repeat enough, this is a quick, dirty and dangerous way to work around. Use at your own risk. I hope we can come up with a proper solution soon.
Cheers,
Neil
Comment #4
edward.peters commentedI had exactly the same problem! Very frustrating. Hope it can be sorted out as it will be a really great module. Thanks to those who have produced it!
Comment #5
fc-mv08 commentedSame problem of CCK blank fields and the crack #3 doesn't work...
Comment #6
Daniel A. Beilinson commentedOkay, changes from #3 need make with includes/database.mysqli.inc, not with database.mysql.inc, because we have error from mysqli file. Works for me.
Comment #7
Junro commentedsame problem, text fields are empty...
Comment #8
Daniel A. Beilinson commentedTry to use crack from #3 with database.mysqli.inc and without
Comment #9
Junro commentedusing crack from #3:
Even if it's working, we can use it on a production site, unless to set the site off-line.
Have you got this too?
Comment #10
Daniel A. Beilinson commentedNo, I can't see this. But my locale module switched off. What kind of fields did you import?
Comment #11
Junro commentedText fields
Node reference fields
Date fields
With Node reference et date fields, i had to set on Select widget to make the import work.
But all import dates are 1970, so wird....
this warning message i've got above is on nodes who contains the text fields.
Comment #12
Daniel A. Beilinson commentedSorry, I don't know.
Btw, about date: date must be select list too, but for me all empty values is 01.01.2009. :-(
Comment #13
Junro commentedMy date is set to select list too, and I don't have empty values to import. Whatever the date I import, it willshow 1970! lol
Comment #14
Daniel A. Beilinson commentedMaybe it's date's problem? Try to use newer version.
Comment #15
Junro commentedI do, always do with Date lol so much problem with it! :)
Comment #16
Daniel A. Beilinson commentedYeah, bull's-eye!
Comment #17
oadaeh commentedWhy not just do:
because that's all that's happening with the fake function.
Really, the best thing to do is to figure out at what point this code is being called incorrectly and change how it's being called, rather than promoting the hack.
It happens for me when I have a date field in the content type, even if that field is not being used. So, I'm guessing that this module is receiving or retrieving data from the date field in a format it doesn't expect, and isn't doing any error checking. I'll probably be back with more information later today, as I need to get this working correctly today.
Comment #18
Junro commentedHello,
When a field is used with more than one node type, the field is not anymore in the table of the node type where the field has been created. It owns his own table.
Maybe node import works only with fields inside the table of the node type whe choose to import.
I just said thaht because ALL my fields inside my node type have been imported, and all fields with their own table have a problem.
Comment #19
oadaeh commented@Junro: Interesting thought, and it might be another clue. I doubt that's the complete answer, however. I have only two node types, and neither one shares any fields, and I have problems importing all of my data.
Comment #20
Daniel A. Beilinson commented@oadaeh: Thank you.
Comment #21
k8 commentedOK still critical here since have so much more to import and still must do the workaround below.
Trying to import a date field is the problem that causes no error message but all other fields to be blank.
So can anyone specify what content type options work to successfully import date fields - just simple yyyy-dd-mm fields into CCK date fields?
My WORKAROUND:
1. Create content field "Start_date_text" of type text
2. Import date content from CSV file (currently just yyyy-mm-dd values)
3. Create content field "Start_date_date" of type date
4. Run SQL query Update table "member.." set Start_date_date = Start_date_text;
Thus Drupal thinks it has a CCK field of type date and acan do Drupal date arithmetic and operations on it.
Comment #22
oadaeh commentedIIRC, this totally worked for me the last time I tried it.
I am using the latest dev version of this module.
What I had to do was to set the date field to custom and specify the format to be the same as the text being imported.
I'm still waiting for the final scrub on the data to do the final and complete import, so I'm in a holding pattern for now.
I'll try to update this issue when I complete the process to let everyone know what my final results were.
Comment #23
makbeta commentedFix #17 has worked for me.
I've attempted to track down the actual issue, but no luck.
I've got as far as to figure out that the source of the problem is that the string of data passed to db_query function (called several times in the main module & in the api file) is passed as an array instead of a string. A more elegant and less risky update to the db_escape_string function is as follows.
This ensures that the function behaves normally under normal circumstances & if we encounter an array only it's first element will be used. This of course does not address the core issue of this problem, but I hope someone who knows this modules code more intimately can make use of this information and make a real fix to the module.
Comment #24
HorsePunchKid commentedSubscribing.
Comment #25
CarbonPig commentedSubscribe and ? -
#17 - where do you put this php?
Thanks,
CarbonPig
Comment #26
Daniel A. Beilinson commented@CarbonPing: Please, look at #3
Comment #27
oadaeh commentedIn light of the recent subscriptions, I wanted to say that I did get this working, w/o using either #3 or #17. It's been a few months now, but IIRC, I got it working by using the following:
I don't know which piece of the puzzle fixed the problem for me, or if it required all of them, but I do know that I was finally able to get something like 15,000 dates imported w/o any problem.
Comment #28
ozecho commentedThe patch in #23 worked for me applying it to database.mysql.inc which is where I was getting my error.
Thanks for the workaround, but have we worked out what is causing it? is it date CCK fields?
Comment #29
twooten commentedI also made the changes in #23 and my data started importing. Thank you makbeta!
Comment #30
daliverse commentedSubscribing.
Comment #31
anonymous07 commentedSubscribe .... been going crazy trying to get D6 upgrade from D5 working (import CSV into date fields for scheduled publishing and unpublishing of nodes) and it might very well be this issue.
EDIT: SOLVED! (Node_Import + CCK + Date + Scheduler + Rules)
Used the clues from post #27 above AND had to disable Date Popup Module (I am not entering any dates manually anyway, they are all coming from the CSV file being imported or being computed by a PHP rule.)
Thanks everyone
Comment #32
nally commentedSubscribe
Comment #33
couash commentedVariant of #23 for mysqli
change the function 'db_escape_string' in includes/database.mysqli.inc to read like this:
Worked for me. Credit goes to makbeta.
*Note for those unfamiliar with php code, don't put the php tags! ;-)
Cheers!
Comment #34
Encarte commentedsubscribing
Comment #35
CarbonPig commentedsubscribe again - continually having text fields that are half imported.