Downloaded the new dev (March 20, 2010), still can't get past step 7. Get this error:

Fatal error: Only variables can be passed by reference in /home/.halloween/jlud/artn.pmcarlson.com/dev/sites/all/modules/node_import/node_import.inc on line 668

Same error I get with the official release (6.x-1.0-rc4). (Might be a different line number, can't remember.)

Using Firefox on Win Vista.

(Did a search for 668, didn't see this posted yet. Apologies if it's already on the list.)

Comments

crashtest_’s picture

I am also getting this error, after using latest CVS 6 version.

Robrecht Jacques’s picture

Status: Active » Postponed (maintainer needs more info)

What is your PHP version?

boabjohn’s picture

G'Day Robrecht,

I just came across this as well. On the latest dev (23-08-2010) and running:

MySQL database 5.0.51a
PHP 5.2.6-1+lenny4
PHP memory limit 256M

Strangely, the import worked first time. I needed to improve a couple of columns, so I deleted all my imported nodes and then tried another import with the slightly improved file...then got the line 668 error above.

Can I supply more info to help with troubleshooting?

nruest’s picture

I am also getting this error. My php version is: PHP 5.2.14-0 & MySQL version 5.1.49.

The odd thing is that the module was working just fine for me last time I did an import, which was about 2 months ago.

boabjohn’s picture

Are these issues related? >> http://drupal.org/node/422322#comment-3583794

My error is also on line 668.

PHP has 196M on mod_php (apache)

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

On my site I also had success with an early version of the node and content. Since then I have added more fields and changed the data (no way to roll back), BUT as noted in the comment linked above I have mapped all data except the Title field to 'none' and am still getting the error.

Where to turn next?

richardsmart’s picture

Yes, the two issues appear to be related. You can fix this problem with a version of #20 from http://drupal.org/node/422322

It's a problem since php 5.0.5 (see http://drupal.org/node/32881):

function Foo (&data) {
// do stuff here
}

function Bar () {
return "hello world";
}

Foo(Bar());

Isn't right, because foo wants a variable (as it should be a reference), but bar returns a string.

So on line 668 of node_import.inc, $function is one of the node_import_check_boolean / node_import_check_date / node_import_check_email etc functions which expect the first parameter to be a
variable. $values[$fieldname][$i] is a string in a number of cases.

Replacing the line (668):
$return = $function($values[$fieldname][$i], $fieldinfo, $options[$fieldname], $preview);
with:
$return = $function($var = $values[$fieldname][$i], $fieldinfo, $options[$fieldname], $preview);

on the latest dev version appears to fix it (however, I am unsure if it is the correct way), and I'm now getting other errors (but am unsure if it's to do with my change or not). I'll give more feedback if I make any more progress.

richardsmart’s picture

Status: Needs review » Postponed (maintainer needs more info)

using #20 from http://drupal.org/node/422322 seems to be the best option to me. The code at line 668 should read:

$tempval = $values[$fieldname][$i]; // line added
$return = $function($tempval, $fieldinfo, $options[$fieldname], $preview);
if ($return === FALSE) {
  $values[$fieldname][$i] = '';
  continue 2;
}
else if ($return === TRUE) {
  $values[$fieldname][$i] = $tempval; // line added
  continue 2;
}

Hope that helps,
Rich

richardsmart’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.15 KB

Here's a patch to the effect of #7 above. Not sure if I should have marked this as duplicate and added the patch to http://drupal.org/node/422322 ? It seems like the code has updated since then, so attached it to this issue.

This in effect is a re-run of http://drupal.org/node/422322 #21, but with #22 taken into consideration, and with the latest code (whereby the error is on line 668)

richardsmart’s picture

Title: Line 668 still getting error » node_import.inc line 668 Fatal error: Only variables can be passed by reference
Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs review

updating title to better reflect issue
updating priority to reflect priority guide (http://drupal.org/node/45111)

pazcu’s picture

Richard,

thank you so much for this patch! I had the same issue on line 666, but your patch worked like a gem...

mynameispj’s picture

Just wanted to say that I also ran into this problem on line 666, and Richard's patch on #8 did the trick.