Created
September 29, 2011 21:18
-
-
Save allixsenos/1251971 to your computer and use it in GitHub Desktop.
xdebug exception fatal
This file contains 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 | |
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