Posted by gallamine on April 3, 2009 at 1:44am
| Project: | Node import |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
When going from step 6 to step 7 I get the following error:
Fatal error: Only variables can be passed by reference in ...node_import.inc on line 588
I've attached a 10 line sample of the CSV file I'm importing. I'm only importing columns, B,C,D,F,G,J,K,R.
I'm running the site on XAMPP for Windows Version 1.7.0. PHP Version 5.2.8. I can't find the MySQL version number or the "Node import debug report". I'm running Drupal 6.10. CCK version 6.x-2.2.
I've attached an export of my content type. I'm only trying to import data into the Text fileds, and a Taxonomy field (version 6.10).
Any ideas? Thanks!
| Attachment | Size |
|---|---|
| robot_listings_sample.csv_.txt | 6.03 KB |
| project_content_type.txt | 17.26 KB |
Comments
#1
Ok, so I've paired down my import file to only ONE row. It still won't import. I'm also importing data into ONLY the title and body field of the content type (the only two required fields). The CSV file is attached. I'm only using columns B and I from the CSV to import into the node title and node body field. For the body field I've tried every different type of input format to no avail.
Help!
#2
Is it possible that your HTML body content is not passing the import filters ?
Not sure if PRE tag is part of the default drupal tag set.
In stepping through node_import, I notice that the form_set_error messages are
swallowed.. I think its because the form is never rendered.. I may be worthwhile
to always do a preview when importing data, so you can monitor each record if
your want to and form_set_error messages will be displayed..
-John G
#3
Pass by reference error fix has been committed. Will be included in -rc5.
#4
I don't want to be pushy, but is there any chance we can get a dev version with the committed changes?
It feels terrible to know the solution to problem is waiting behind the next release candidate, which understandably may be weeks away.
Thanks again for the great work!
#5
Here you can download the -dev release. It is generated automatically every day from CVS.
Beter may be to use CVS directly, see http://drupal.org/node/4840/cvs-instructions/DRUPAL-6--1.
#6
Thanks for the awesome fast reply!... Unfortunately step 7 now gives me the same error, but now on line 594, instead of 588. (Using the 1.x-dev from CVS)
...I just hope I'm not out of line changing the status and version of this issue.
#7
Hi! Absolutely the same problem. I've used node import for a while and it worked perfect, but after updating cck (not shure) I started to get this error.
Error occurs only when I try to import ubercart product content type.
Previous successfull imports (csv files stored on the server) do not work now as well as new ones.
I'm running PHP 5.2.5, Drupal 6.10, CCK 6.x-2.2 , Advanced help 6.x-1.2
#8
hmmm... I've tryed to cr8 new ubercart content type and everything started to work well. It seems there was a problem in cck/ubercart db tables which were self-fixed after I cr8ed new ubercart content type (product class).
#9
I'm having the exact same issue as techninja, and I'm also only having the issue with ubercart products.
#10
i have the same problem as techninja
i ran the node import an had an error on line 594 after installing the dev version out of the
cvs it gives me an error on line 615
Panda
#11
Has anyone found a fix to this?
#12
I'm having the same problem. I can't even import a simple one line title.
I UPDATED to PHP 5.2.9 and still have the same problem using the most current dev module (apr 22,2009). Now the error is line 664.
I found this post: http://the-stickman.com/web-development/php/php-505-fatal-error-only-var... and I'm wondering if line 664 can be rewritten? Any ideas are welcomed.
#13
I had the same error when importing.
I fixed it with a hackish workaround.
This is not ideal but anything to avoid a fatal error!
After this, 100 nodes imported, with attached files, successfully.
node_import.inc, line 664
// a string value of '1' was causing the error, so just skip itif($values[$fieldname][$i] === '1'){continue 2;} // add this line
$return = $function($values[$fieldname][$i], $fieldinfo, $options[$fieldname], $preview);
This may help until a better fix is found.
#14
I have the same problems, but how to download files quickly and easily withoutcommand line from here?
http://drupal.org/node/4840/cvs-instructions/DRUPAL-6--1
#15
I tryed to use the SmartCVS, using user:anonymous server: cvs.drupal.org but which are REPOSITORY PATH and PASSWORD? to download files by hand from here look to be a terrible wast of time:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/node_import/
#16
Patching the line as written here http://drupal.org/node/422322#comment-1536188 then is going well!
#17
I think I've solved it for real with the link from #12 -
Change this line:
$return = $function($values[$fieldname][$i], $fieldinfo, $options[$fieldname], $preview);to this:
$tempvar = $values[$fieldname][$i];$return = $function($tempvar, $fieldinfo, $options[$fieldname], $preview);
Let me know if this works for others.
edit: was missing a ; on the $tempvar line, thanks RAk!
#18
patch from #17 is worked.
#19
For me the issue seems to be occuring when a field is marked as "has_multiple", and yet the variable in $values[$fieldname] is NOT an array. I've found a simple (and fairly quick) way of recreating this issue.
The attached patch checks to see if $values[$fieldname] is an array, and if so continue as normal. If it isn't an array, then $values[$fieldname] is passed instead (which in my case is what needed to be passed to the function).
#20
Thanks for the hint. In my case it removes the fatal error but then i get an error
"An illegal choice has been detected. Please contact the site administrator." and the import fails.
To solve the problem i have added an extra line. The full change is now:
On line 594 change this:
$return = $function($values[$fieldname][$i], $fieldinfo, isset($options[$fieldname]) ? $options[$fieldname] : array(), $preview);if ($return === FALSE) {
$values[$fieldname][$i] = '';
continue 2;
}
else if ($return === TRUE) {
continue 2;
Into this:
Regardshovel
$tempvalue = $values[$fieldname][$i]; // line added
$return = $function($tempvalue, $fieldinfo, isset($options[$fieldname]) ? $options[$fieldname] : array(), $preview); // Changed
if ($return === FALSE) {
$values[$fieldname][$i] = '';
continue 2;
}
else if ($return === TRUE) {
$values[$fieldname][$i] = $tempvalue; // Line added
continue 2;
#21
The following patch worked for me.
Thank you for such a useful module.
#22
It might work in some situation but it dit not work for me.
The reason is that $function() will change the variable passed as parameter 1 ($values[$fieldname][$i]), that is why it is passed by reference.
When a temporary variable is used ($val) this temporary variable is changed and this change does not get back in original variable.
To copy the change into the origina variable one has to add statement "$values[$fieldname][$i] = $val;" after "else if ($return === TRUE) {"
#23
I was having this problem and I found out it was caused by a cck field with a filter and set with no limit of possible values. The problem didn't occurred with fields that had filters but limited values and it also didn't occurred with fields with plain text and infinite values.
So, I just changed that cck field to plain text and the problem was solved.
I hope this workaround helps non-developers.
#24
This helped. Thank you!
RE:
Thanks for the hint. In my case it removes the fatal error but then i get an error
"An illegal choice has been detected. Please contact the site administrator." and the import fails.
To solve the problem i have added an extra line. The full change is now:
On line 594 change this:
$return = $function($values[$fieldname][$i], $fieldinfo, isset($options[$fieldname]) ? $options[$fieldname] : array(), $preview);
if ($return === FALSE) {
$values[$fieldname][$i] = '';
continue 2;
}
else if ($return === TRUE) {
continue 2;
Into this:
Regards
hovel
$tempvalue = $values[$fieldname][$i]; // line added
$return = $function($tempvalue, $fieldinfo, isset($options[$fieldname]) ? $options[$fieldname] : array(), $preview); // Changed
if ($return === FALSE) {
$values[$fieldname][$i] = '';
continue 2;
}
else if ($return === TRUE) {
$values[$fieldname][$i] = $tempvalue; // Line added
continue 2;
#25
wow
I thought this was a popular module and that the migrate modules uses it.
http://drupal.org/node/422322#comment-1614428
I still needed to apply this patch a year later even after downloading the latest csv version.
How can we help out to clear up why this is happening and put this fix into the code?
#26
I think that our developer solved this issue on the July 11/10 -dev version. I managed to get 800+ rows imported today successfully. If it holds up (I have a few more imports to try, and from there I can vouch for it working) I will see if we can post a patch against this -dev version.
#27
Well, latest dev (Jul 11) no go for me.
Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
I do have a bunch of content taxonomy fields, and have applied the content_taxonomy.inc.
But just to be sure I'm only trying to map one field (title) in the import. No other fields are required by the node type and I'm not mapping any. Failure occurs on line 668.
What else is there to try?
#28
Okay, successive patching and testing got me to a partially successful import at #22 above.
Thanks to you all for the clever coding. Hope something more robust moves toward the devel version soon.
I'm going to pop some "appreciation" in Jaques' cookie jar right now!
#29
#23 - awesome worked great. I was importing uc_products and had my cck image field set to "unlimited". As soon as I changed this to "1" it was back working - thanks.
#30
Fix by hovel, sirkitree added to 6.x-1.x-dev. Will be included in 6.x-1.2.
Thanks!
#31
Automatically closed -- issue fixed for 2 weeks with no activity.
#32
I still get this on line 666 no less using 6.x.1.1. Reopening the issue. When is 1.2 coming?
#33