mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11495] Throw exception when item that should be deleted does not exist
PHPBB3-11495
This commit is contained in:
@@ -181,9 +181,20 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
|
||||
*/
|
||||
protected function remove_item_from_nestedset($item_id)
|
||||
{
|
||||
$item_id = (int) $item_id;
|
||||
if (!$item_id)
|
||||
{
|
||||
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||
}
|
||||
|
||||
$items = $this->get_subtree_data($item_id);
|
||||
$item_ids = array_keys($items);
|
||||
|
||||
if (empty($items) || !isset($items[$item_id]))
|
||||
{
|
||||
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||
}
|
||||
|
||||
$this->remove_subset($item_ids, $items[$item_id]);
|
||||
|
||||
return $item_ids;
|
||||
|
Reference in New Issue
Block a user