set / enum definitions broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
chive |
Fix Released
|
High
|
Matthias Burtscher |
Bug Description
Using Opera for Windows you cannot properly define "enum" and "set" data types. You get: "enum('
define('CR', "\r");
define('LF', "\n");
define('CRLF', "\r\n");
foreach ($_POST as $k => $v) {
$_POST[$k] = str_replace(CRLF, LF, $v); // Windows case
$_POST[$k] = str_replace(CR, LF, $v); // Exotic OSes case
}
The following code executed before each operation on $_POST data will prevent ALL line ending related bugs possible with ANY OS / ANY BROWSER, ever. It's good to check line endings in all code which directly depends on them.
I posted this error for Chive 0.2.0 and it was fixed incorrectly, that's why I post detailed description. The error could be impossible to reproduce using OS other than Windows or browsers other than Opera, so please just apply described filtering by default, it's perfectly safe.
Changed in chive: | |
assignee: | nobody → David Roth (davrot) |
importance: | Undecided → High |
milestone: | none → 0.4.0 |
status: | New → Triaged |
Changed in chive: | |
status: | In Progress → Fix Committed |
Changed in chive: | |
status: | Fix Committed → Fix Released |
I added described conversion to index.php as quick fix, but it didn't help - extra LFs were added somwhere else, which shows previously bug was fixed in very wrong way causing more damage than profit. Please note the conversion cannot be done any other way. First - it should be done ONLY ONCE in whole code, then the sequence of replacing must be exactly as described or it can produce unpredictable results.