Skip to content

Instantly share code, notes, and snippets.

@allixsenos
Created September 29, 2011 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allixsenos/1251971 to your computer and use it in GitHub Desktop.
Save allixsenos/1251971 to your computer and use it in GitHub Desktop.
xdebug exception fatal
<?php
ini_set("display_errors", 1);
ini_set("error_reporting", E_ALL);
echo "<pre>";
class MyException extends Exception {
function __construct($message) {
parent::__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) {
["message":protected]=>
string(3) "BLA"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(61) "/www/deviantart.lan/xdebugexception.php"
["line":protected]=>
string(2) "42"
["trace":"Exception":private]=>
array(0) {
}
["previous":"Exception":private]=>
NULL
}
survived
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