aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/tree/nestedset.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-04-30 22:19:35 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-04-30 22:19:35 +0200
commitd7787682df0474b7bb78434339f8edde3727c580 (patch)
treef560b0b16dced1d1669e3bed3cd59c3e4f8f40a6 /phpBB/includes/tree/nestedset.php
parent6a7378ecbdeea1ad356cbde8a085aa7510c61788 (diff)
downloadforums-d7787682df0474b7bb78434339f8edde3727c580.tar
forums-d7787682df0474b7bb78434339f8edde3727c580.tar.gz
forums-d7787682df0474b7bb78434339f8edde3727c580.tar.bz2
forums-d7787682df0474b7bb78434339f8edde3727c580.tar.xz
forums-d7787682df0474b7bb78434339f8edde3727c580.zip
[ticket/11495] Throw exception when item that should be deleted does not exist
PHPBB3-11495
Diffstat (limited to 'phpBB/includes/tree/nestedset.php')
-rw-r--r--phpBB/includes/tree/nestedset.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/phpBB/includes/tree/nestedset.php b/phpBB/includes/tree/nestedset.php
index 2f17ebab02..4d851a87a8 100644
--- a/phpBB/includes/tree/nestedset.php
+++ b/phpBB/includes/tree/nestedset.php
@@ -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;