Skip to content

Commit

Permalink
fix numericopt setting
Browse files Browse the repository at this point in the history
In 55a4f13 a bug was introduced that

* forced resaving the config even if it hadn't changed
* prevented setting the value to an empty string once set
  • Loading branch information
splitbrain committed May 25, 2018
1 parent 5f43ccc commit f37fd93
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/plugins/config/_test/Setting/SettingNumericoptTest.php
@@ -0,0 +1,23 @@
<?php

namespace dokuwiki\plugin\config\test\Setting;

/**
* @group plugin_config
* @group admin_plugins
* @group plugins
* @group bundled_plugins
*/
class SettingNumericoptTest extends SettingNumericTest {

/** @inheritdoc */
public function dataOut() {
return array_merge(
parent::dataOut(),
[
['', "\$conf['test'] = '';\n"],
]
);
}

}
2 changes: 2 additions & 0 deletions lib/plugins/config/core/Setting/SettingNumericopt.php
Expand Up @@ -15,6 +15,8 @@ class SettingNumericopt extends SettingNumeric {
*/
public function update($input) {
if($input === '') {
if($input == $this->local) return false;
$this->local = $input;
return true;
}

Expand Down

1 comment on commit f37fd93

@Chris--S

This comment was marked as resolved.

Please sign in to comment.