PDA

View Full Version : ImpEx 1.74 "Only variables can be passed by reference" error in ImpexData.php


cheap56k
Thu 15th Sep '05, 5:13am
I'm running PHP 5.0.5, vBulletin 3.0.9, ImpEx 1.74. When on "003 Import User Groups and Ranks", I got the following error:

Fatal error: Only variables can be passed by reference in /xxxxxxxxxx/ImpExData.php on line 159

I fixed it by changing the code from:


function ImpExData(&$Db_object, &$sessionobject, $type)
{
$this->_datatype=$type;
$this->_values = $this->create_data_type(
$Db_object,
$sessionobject->get_session_var('targetdatabasetype'),
$sessionobject->get_session_var('targettableprefix'),
$type
);

To:


function ImpExData(&$Db_object, &$sessionobject, $type)
{

$targetdatabasetype = $sessionobject->get_session_var('targetdatabasetype');
$targettableprefix = $sessionobject->get_session_var('targettableprefix');

$this->_datatype=$type;
$this->_values = $this->create_data_type(
$Db_object,
$targetdatabasetype,
$targettableprefix,
$type
);

I just wanted to share this in case anyone else has the same problem, and as a bugfix suggestion for future releases.

Freddie Bingham
Thu 15th Sep '05, 7:40pm
This is because php5 doesn't allow function paramaters that are declared as references to be passed in directly from a function call. A defined variable must be passed in.