From 35677336de4c01c4f6b02840222075c6ac963988 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Tue, 3 Mar 2009 21:33:52 +0000 Subject: 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 --- actions/newnotice.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actions/newnotice.php') 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); -- cgit v1.2.3-54-g00ecf