Skip to content

Commit da65c7e

Browse files
matheuszychthojou
authored andcommitted
BookingPool: Fix ObjectEvent Deletion Crash
See: https://mantis.ilias.de/view.php?id=48259 `ObjectEvent::handleDeletion` crashed when called with ref ids that are not booking pools. The method now checks that the reference exists and has type `book` before loading the pool.
1 parent 2e8ac86 commit da65c7e

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

components/ILIAS/BookingManager/Objects/ObjectEvent.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,25 @@
2222

2323
use ilBookingObject;
2424
use ilObjBookingPool;
25-
use ilObjectTypeMismatchException;
25+
use ilObject;
2626

2727
class ObjectEvent
2828
{
2929
public function handleDeletion(array $booking_pool_ref_ids): void
3030
{
3131
foreach (array_unique($booking_pool_ref_ids) as $booking_pool_ref_id) {
32-
try {
33-
$pool_id = (new ilObjBookingPool($booking_pool_ref_id, true))->getId();
34-
} catch (ilObjectTypeMismatchException) {
32+
if (!is_numeric($booking_pool_ref_id)) {
3533
continue;
3634
}
35+
$booking_pool_ref_id = (int) $booking_pool_ref_id;
3736

38-
foreach (ilBookingObject::getList($pool_id) as $booking_object) {
37+
if (!ilObject::_exists($booking_pool_ref_id, true, 'book')) {
38+
continue;
39+
}
40+
41+
$booking_pool = new ilObjBookingPool($booking_pool_ref_id, true);
42+
43+
foreach (ilBookingObject::getList($booking_pool->getId()) as $booking_object) {
3944
$booking_object_id = $booking_object['booking_object_id'] ?? null;
4045
if ($booking_object_id === null) {
4146
continue;

0 commit comments

Comments
 (0)