Last active
December 21, 2015 08:28
-
-
Save ronan-gloo/6278100 to your computer and use it in GitHub Desktop.
ATOUM: Get last error in exception callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function toto($pattern, $value) { | |
$split = preg_split($pattern, $value); | |
if ($error = error_get_last()) { | |
throw new Exception($error['message'], Exception::INVALID_PARAMETER); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->exception(function()use($object){ | |
$object->toto('invalid pattern', 'value'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L'exception n'est pas lancée puisque error_get_last retourne
null