[eluser]CroNiX[/eluser]
$this->uri->segment() returns a string, or boolean FALSE if the segment doesn't exist. So, it will never be an int unless you cast it like $gallery_id = (int)$gallery_id; If you do that though, it will never be boolean FALSE, it will be 0 in that case.
Code:
else if($action == 'edit')
{
$gallery_id = $this->uri->segment(5, FALSE);
//if the segment exists, cast it as an int or else trigger 404
if ($gallery_id !== FALSE)
{
$gallery_id = (int)$gallery_id;
}
else
{
show_404();
}
}
You can check for yourself by running var_dump($gallery_id); right after you get it from the segment before doing anything else.