Have get_arg never return null
90% of places assume it will never return null, and they will break in weird ways if it does return null
This commit is contained in:
@ -187,11 +187,13 @@ class Upload extends Extension
|
||||
throw new UploadException("Can not replace Image: disk nearly full");
|
||||
}
|
||||
// Try to get the image ID
|
||||
$image_id = int_escape($event->get_arg(0));
|
||||
if (empty($image_id)) {
|
||||
$image_id = isset($_POST['image_id']) ? $_POST['image_id'] : null;
|
||||
if($event->count_args() >= 1) {
|
||||
$image_id = int_escape($event->get_arg(0));
|
||||
}
|
||||
if (empty($image_id)) {
|
||||
elseif(isset($_POST['image_id'])) {
|
||||
$image_id = $_POST['image_id'];
|
||||
}
|
||||
else {
|
||||
throw new UploadException("Can not replace Image: No valid Image ID given.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user