View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006147 | OXID eShop (all versions) | 4.01. Database handling | public | 2015-05-21 08:58 | 2024-02-07 08:36 |
Reporter | michael_keiluweit | Assigned To | |||
Priority | low | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 4.9.4 / 5.2.4 | ||||
Summary | 0006147: It is possible to store oxconfig rows with the same oxvarname (for the same oxshopid and oxmodule) | ||||
Description | There 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 Reproduce | Execute 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 Information | This 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. | ||||
Tags | No tags attached. | ||||
Theme | All | ||||
Browser | All | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||
|
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. |
|
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 |