?
avatar Gorzin
Gorzin
28 Sep 2017

Steps to reproduce the issue

Since I installed joomla 3.8.0 items are inserted twice in the database. I tried several methods and nothing works:

// method 1
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$profile = new stdClass();
$profile->modif_id = $modif_id;
$profile->product_id= $ajout_prod_id;
$profile->nombre= $ajout_prod_number;
$result = $db->insertObject('mytable', $profile);

//method 2
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = "INSERT INTO mytable (modif_id, product_id, nombre) VALUES ('".$modif_id."', '".$ajout_prod_id."', '".$ajout_prod_number."')";
$db->setQuery($query);
$db->execute($query);

Expected result

Item inserted in the database only once

Actual result

Item inserted twice in the database

System information (as much as possible)

Joomla 3.8.0
Regular Labs - Sourcerer 7.1.9

Additional comments

Everything was working well before the 3.8.0 update. It has been stable for years.

avatar Gorzin Gorzin - open - 28 Sep 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Sep 2017
avatar brianteeman
brianteeman - comment - 28 Sep 2017

This is possibly the plugin firing twice issue reported before.

avatar mbabker
mbabker - comment - 28 Sep 2017

Unless this code is being run in a plugin (there's nothing here giving context of where the insert query is being executed, the only possible pointer is they explicitly listed Sourcerer in their report), that issue wouldn't affect the database API as the database has no events.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Sep 2017

@Gorzin maybe #18066 solve issue?

avatar Gorzin Gorzin - change - 28 Sep 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-09-28 13:46:17
Closed_By Gorzin
avatar Gorzin Gorzin - close - 28 Sep 2017
avatar Gorzin
Gorzin - comment - 28 Sep 2017

The code was executed in a plugin that was executed twice. I had to change an include to include_once.

Thanks for the quick replies

Add a Comment

Login with GitHub to post a comment