diff options
author | CiaranG <ciaran@ciarang.com> | 2009-03-03 21:33:52 +0000 |
---|---|---|
committer | CiaranG <ciaran@ciarang.com> | 2009-03-03 21:33:52 +0000 |
commit | 35677336de4c01c4f6b02840222075c6ac963988 (patch) | |
tree | 8a6dd0e4af1491c1f8757bf5143f22f92922f7ca /actions | |
parent | 3fd877c4cecd80fbe65043dd4612d9688e16ecd8 (diff) |
Catch bad replyto IDs before saving a new notice to avoid a constraint violation. This happens, for example, when posting for the first time on a fresh install
Diffstat (limited to 'actions')
-rw-r--r-- | actions/newnotice.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php index 9f44d2516..cbd04c58b 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -152,6 +152,11 @@ class NewnoticeAction extends Action } $replyto = $this->trimmed('inreplyto'); + #If an ID of 0 is wrongly passed here, it will cause a database error, + #so override it... + if ($replyto == 0) { + $replyto = 'false'; + } $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto); |