onAfterImportCSVRow: mysql extension is deprecated

Status
Not open for further replies.

s6930064

Member
Hi,
I tried the CSV import and i got the following message:
'Caught exception on eval in onAfterImportCSVRow : mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead'

I use PHP 5.5.9, Joomla 3.4.8 and latest fabrik 3.x from github.
 
Do you have any code in your list csv plugin?
What is your Database Type (in Global config/Server)?
 
In Joomla Global config/Server the database type is 'MySQL'. If i change this to MySQLi the message i get is different:
'Caught exception on eval in onAfterImportCSVRow : mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead'

If i use the MySQL(PDO) i get a server error 500.

I run a small code where i check the data (no sql involved). I have followed the instruction for 3.1 from the wiki page (http://fabrikar.com/forums/index.php?wiki/list-csv-list-plugin/) with the only difference that if i found a value that is not correct i modify it with '$formModel->updateFormData....' because the logic from the wiki '$formModel->formData['us_streets___street_desc'] = "testing";' is not updating the value and in db it stores the old values.
 
here is the code that i have in the listcsv plugin Import PHP File:

defined('_JEXEC') or die();
$listModel = $this->getModel();
$formModel = $listModel->getFormModel();
$data = $formModel->formData;
$origref = $_SERVER['HTTP_REFERER'];
$q = JURI::getInstance($origref)->getQuery(true);
$fid = $q['i'];
// modify csv data
// use updateFormData from the example plugins/fabrik_list/listcsv/scripts/import_cities.php
// because $formModel->formData['table___field'] = "testing" from the wiki is not storing in the db the altered value.
$today = date("Y-m-d H:i:s");
$formModel->updateFormData('tbl_table___date_time', $today, true);
$formModel->updateFormData('tbl_table___fid', $fid, true);

The error that i get (one per each csv entry that is inserted) is:
'An error has occurred with a eval'd field - please inform the web-site owner. Debug: Caught exception on eval in onAfterImportCSVRow : mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead'
img1.png

PS: i do not use 'After Import PHP File' option and all data are simple with no merge or join. I took a look in the 'listcsv_after_import_php_code' inside the DB and the value is "".
If i put a simple "return true;" then the onAfterImportCSVRow error is not displayed anymore.
 
Last edited:
Yup, there was an issue with the listcsv if the PHP code was empty - we were still trying to evaluate an empty string. Which is what generated the actual error. Then because you are using the mysql drivers rather than mysqli, and you have error reporting set to 'Maximum' (so it's logging deprecated warnings), you are seeing those as well. That's not a "Fabrik thing", that's just what happens now in new(ish) versions of PHP when using the mysql drivers. You should switch to mysqli.

Anyway ... update from github (see your other thread where I posted the addition of the onCompeteImportCSV hook), switch J! to use mysqli, and it should be OK.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top