Ticket #1915 (closed defect: wontfix)
Exception when putting twice an unset setting
Reported by: | bruno | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | module:core | Version: | 2.6.1 |
Severity: | normal | Keywords: | |
Cc: |
Description
When using the following piece of code :
$core->blog->settings->addNamespace('test'); $core->blog->settings->test->put('foo','bar','string'); $core->blog->settings->test->put('foo','bar','string');
The exception " Uncaught exception 'Exception' with message 'columns setting_ns, setting_id, blog_id are not unique " is raised.
Explanation : when adding/updating a setting, the database is updated, but the object is not updated. Therefore, when performing the second put, the object thinks that the setting is not set, and then tries to insert its value in the base whereas it already exists.
The object should be updated when the database is updated to prevent this strange behavior.
The example is quite idiot, but can occur sometines in weird situations (for instance when a plugin is installed and a behavior is called after a triggerblog)
Change History
Note: See
TracTickets for help on using
tickets.
This is a variant of ticket ... #185