note 96289 added to language.exceptions.extending
| From: | joechrz at gmail dot com | Date: | Thu, 18 Feb 2010 23:18:14 +0000 |
| Subject: | note 96289 added to language.exceptions.extending | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166159@lists.php.net to get a copy of this message | ||
It's important to note some unexpected behavior when overriding the __toString method of an
Exception. The default PHP exception handler will truncate the result of the __toString method to
the number of bytes specified by log_errors_max_len in php.ini.
To get around this problem, you need to either change the value of log_errors_max_len:
<?php
// recommended: disable error logging
// so the log files don't become bloated from huge
// exception strings
ini_set('log_errors','off');
// log_errors_max_len = infinite length
ini_set("log_errors_max_len",0);
?>
or specify a custom exception handler:
<?php
function long_exception_handler($exception) {
// for compatibility, call __toString
echo $exception->__toString();
}
set_exception_handler('long_exception_handler');
?>
----
Server IP: 69.147.83.197
Probable Submitter: 67.248.26.130
----
Manual Page -- http://www.php.net/manual/en/language.exceptions.extending.php
Edit -- https://master.php.net/note/edit/96289
Del: integrated -- https://master.php.net/note/delete/96289/integrated
Del: useless -- https://master.php.net/note/delete/96289/useless
Del: bad code -- https://master.php.net/note/delete/96289/bad+code
Del: spam -- https://master.php.net/note/delete/96289/spam
Del: non-english -- https://master.php.net/note/delete/96289/non-english
Del: in docs -- https://master.php.net/note/delete/96289/in+docs
Del: other reasons-- https://master.php.net/note/delete/96289
Reject -- https://master.php.net/note/reject/96289
Search -- https://master.php.net/manage/user-notes.php