Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
xdebug exception fatal
ini_set("display_errors", 1);
ini_set("error_reporting", E_ALL);
echo "<pre>";
class MyException extends Exception {
function __construct($message) {
$this->line = "42"; // this triggers it. if it's before the constructor, PHP freaks out regardless of xdebug
try {
throw new MyException();
} catch (Exception $ex) {
var_dump ($ex);
echo "survived";
without xdebug:
object(MyException)#93 (7) {
string(3) "BLA"
string(0) ""
string(61) "/www/deviantart.lan/xdebugexception.php"
string(2) "42"
array(0) {
with xdebug:
( ! ) Fatal error: Your exception class uses incorrect types for common properties: 'message' and 'file' need to be a string and 'line' needs to be an integer. in /www/deviantart.lan/xdebugexception.php on line 17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment