PHP | Problem - I suck at error handling
//Popover Shortcode Function
public function Popover($arguments, $text = null) {
//Stop SilverStripe breaking with a [Notice] Undefined index: id error.
//This isn't working
try {
$PopoverID = $arguments['id'];
} catch (Exception $e) {
return null;
}
...
//Proceed as normal
...
}
17/05/2012 5:03am
PHP | Solution - Sticks
//Instead of try/catch use the below if statement.
if (!isset($arguments['id'])) {
return null;
}
Fixed