Skip to content

Instantly share code, notes, and snippets.

@ronan-gloo
Last active December 21, 2015 08:28
Show Gist options
  • Save ronan-gloo/6278100 to your computer and use it in GitHub Desktop.
Save ronan-gloo/6278100 to your computer and use it in GitHub Desktop.
ATOUM: Get last error in exception callback
<?php
function toto($pattern, $value) {
$split = preg_split($pattern, $value);
if ($error = error_get_last()) {
throw new Exception($error['message'], Exception::INVALID_PARAMETER);
}
}
<?php
$this->exception(function()use($object){
$object->toto('invalid pattern', 'value');
});
@ronan-gloo
Copy link
Author

L'exception n'est pas lancée puisque error_get_last retourne null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment