Fixed Edit bookmark throws internal error if bookmark message is too long

Xon

Well-known member
Affected version
2.2.15
Code:
LogicException: Cannot save with validation errors. Use validate() to ensure there are no errors. (First error: Please enter a value using 280 characters or fewer.) src/XF/Service/ValidateAndSavableTrait.php:36

Stack trace
#0 src/XF/ControllerPlugin/Bookmark.php(188): XF\Service\Bookmark\Editor->save()
#1 src/XF/ControllerPlugin/Bookmark.php(23): XF\ControllerPlugin\Bookmark->actionSaveBookmark(Object(XF\Entity\Post), '/posts/15877642...')
#2 src/XF/Pub/Controller/Post.php(370): XF\ControllerPlugin\Bookmark->actionBookmark(Object(XF\Entity\Post), '/posts/15877642...')
#3 src/XF/Mvc/Dispatcher.php(352): XF\Pub\Controller\Post->actionBookmark(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'Bookmark', Object(XF\Mvc\RouteMatch), Object(SV\CollaborativeThreads\XF\Pub\Controller\Post), NULL)
#5 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Post), NULL)
#6 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#8 src/XF.php(524): XF\App->run()
#9 index.php(20): XF::runApp('XF\\Pub\\App')
#10 {main}
 
The problem is the edit code path is this:
PHP:
$editor = $this->setupBookmarkEditor($bookmark);
$editor->save();

$this->finalizeBookmarkEditor($editor);

Instead of:
PHP:
$editor = $this->setupBookmarkEditor($bookmark);
if (!$editor->validate($errors))
{
    throw $this->exception($this->error($errors));
}
$editor->save();

$this->finalizeBookmarkEditor($editor);
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.16).

Change log:
Gracefully handle errors when editing bookmarks
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom