I’m working with the Slim version 2.6.1 (due to some limitation in the company current PHP version) and when trying to use flash messages inside of a try { } catch() {} block the messages are not stored in the session when the template is rendered.
I’ve figured out that the try block create a “isolated scope”. So, I tried to to put a return false before the redirect to test if the in next page the flash message would show up. And finally the flash message was stored in the $_SESSION variable (of course the redirection was not executed, but at least I’ve discovered that the issue is related with the try scope).
Then, the solution I found was to raise an exception and do the redirect inside the catch block. Like this:
$objValidation = FormValidator::isValidData($post);
if($objValidation->bolHasError)
{
throw new Exception('validation_error');
}