View Issue Details

IDProjectCategoryView StatusLast Update
0006147OXID eShop (all versions)4.01. Database handlingpublic2024-02-07 08:36
Reportermichael_keiluweit Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version4.9.4 / 5.2.4 
Summary0006147: It is possible to store oxconfig rows with the same oxvarname (for the same oxshopid and oxmodule)
DescriptionThere is no barrier to create oxconfig rows with the same oxvarname and oxshopid (+ oxmodule). Therefore the method oxConfig::getConfigParam() will return an unexpected value.

+----------------------------------+----------+----------+--------------+-----------+
| oxid                             | oxshopid | oxmodule | oxvarname    | oxvartype |
+----------------------------------+----------+----------+--------------+-----------+
| bdea8f58a4fa95e831a000d3d879cc06 |        1 |          | sExample6147 | str       |
| 8236289125536135a11e93389fa54272 |        1 |          | sExample6147 | str       |
| eeb6fbb9ac9ddfef6a8c101ec9993033 |        1 |          | sExample6147 | str       |
+----------------------------------+----------+----------+--------------+-----------+


The rows have the following values:

bdea...: foobar_0
8236...: foobar_1
eeb6...: foobar_2

When reading the value "sExample6147" via the config getter, I got the value foobar_2, in my testing.

Steps To ReproduceExecute the following SQL query (as it could be executed at an onActivate method or during an import of an install.sql):

INSERT INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`, `OXTIMESTAMP`) VALUES
('bdea8f58a4fa95e831a000d3d879cc06', 1, 'a', 'sExample6147', 'str', 0x792d0785929c26c7, '2015-05-29 07:54:03'),
('8236289125536135a11e93389fa54272', 1, 'a', 'sExample6147', 'str', 0x792d0785929c26c7, '2015-05-29 07:54:03'),
('eeb6fbb9ac9ddfef6a8c101ec9993033', 1, 'a', 'sExample6147', 'str', 0x792d0785929c26c7, '2015-05-29 07:54:03');



Call the config variable:

var_dump(oxRegistry::getConfig()->getConfigParam('sExample6147'));
Additional InformationThis case can be happen as an accident by an module writer, but the shop should catch it by adding a simple unique state of the fields oxshopid, oxmodule and oxvarname.
TagsNo tags attached.
ThemeAll
BrowserAll
PHP VersionNot defined
Database VersionNot defined

Relationships

related to 0006156 resolvedSvenBrunk The configuration parameter "aLanguageParams" occurs twice in the table oxconfig 

Activities

martinwegele

2015-06-01 10:18

reporter   ~0010999

Last edited: 2015-06-03 14:48

Proposal for a simple solution on the DB side:
CREATE UNIQUE INDEX confvar ON oxconfig (oxshopid, oxmodule, oxvarname);

However this will not work initially since all shops that were installed with the regular setup will have duplicate entries of aLanguageParams in their oxconfig table: see 0006156
Duplicate entries cannot occur if you use the shop framework's method oxConfig::saveShopConfVar because this one will delete old entries first before inserting the new one.

SvenBrunk

2024-02-07 08:36

administrator   ~0016254

Just a small update: This problem will be fixed in the upcoming major release as the configuration will no longer be stored in the database