View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0021124 | mantisbt | administration | public | 2016-06-16 04:40 | 2016-07-09 19:28 |
Reporter | atrol | Assigned To | dregad | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.0-rc.2 | ||||
Target Version | 1.3.0 | Fixed in Version | 1.3.0 | ||
Summary | 0021124: Creating/setting config options using adm_config_report.php is partially broken | ||||
Description | Trying to set options sometimes throws It happens whenever a value should be set to a value which is considered to be empty in PHP [1]. Caused by this piece of code in Tokenizer class | ||||
Tags | No tags attached. | ||||
Are you only talking about trying to set a scalar value (i.e. not an array), e.g. leaving the 'Value' text area blank (= empty string), or setting value '0' (without the quotes) ? Or did you notice the same problem using arrays too ? If so, I'd appreciate an example of string that triggers the exception. |
|
e.g. |
|
I failed to consider the fact that '0' == 0 == emtpy(). I'll also improve the handling of empty strings |
|
Integer values like -1 do als not work |
|
Yes I noticed that while testing the issue with 0 values. The same behavior occurs with positive numbers (e.g. '+1'). I added a test case for this already, the fix should be quite simple. |
|
PR for review & test: https://github.com/mantisbt/mantisbt/pull/796 |
|
MantisBT: master-1.3.x afdd002a 2016-06-16 14:24 Details Diff |
Config tests: add cases for '0' and '' (issue 0021124) |
Affected Issues 0021124 |
|
mod - tests/Mantis/ConfigParserTest.php | Diff File | ||
MantisBT: master-1.3.x 9636642a 2016-06-16 15:54 Details Diff |
Tokenizer: no exception in constructor when given empty string An empty string is a valid code snippet and as such should not trigger an exception. Doing so forces the caller to perform additional error handling. Fixes 0021124 |
Affected Issues 0021124 |
|
mod - core/classes/Tokenizer.class.php | Diff File | ||
MantisBT: master-1.3.x b1173d80 2016-06-16 15:56 Details Diff |
Improve handling of empty values in adm_config_set.php When processing an empty value, the code now evaluates the config type as if user had selected 'default'; this ensures the proper case of 'empty' is used depending on the config being set (i.e. 0, ''). We also avoid calling the config parser in this case, because a simple typecast is sufficient to process user input. Fixes 0021124 |
Affected Issues 0021124 |
|
mod - adm_config_set.php | Diff File | ||
MantisBT: master-1.3.x 9ed0b9f5 2016-07-03 01:50 Details Diff |
Fix config parsing issues and improve unit tests PR https://github.com/mantisbt/mantisbt/pull/796 Fixes 0021124, 0021136 |
Affected Issues 0021124, 0021136 |
|
mod - adm_config_report.php | Diff File | ||
mod - adm_config_set.php | Diff File | ||
mod - core/classes/ConfigParser.class.php | Diff File | ||
mod - core/classes/Tokenizer.class.php | Diff File | ||
mod - tests/Mantis/ConfigParserTest.php | Diff File |