By default, no longer treat deprecations as errors

Close #363.

See also https://www.youtube.com/watch?v=9crnlHLVdno
This commit is contained in:
Fredrick Brennan
2020-01-20 10:01:23 +08:00
parent a2ba03849f
commit 5e809047ad
2 changed files with 10 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
* Copyright (c) 2010-2014 Tinyboard Development Group
*/
if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
// You cannot request this file directly.
exit;
@@ -279,7 +280,7 @@ function loadConfig() {
if ($config['verbose_errors']) {
set_error_handler('verbose_error_handler');
error_reporting(E_ALL);
error_reporting($config['deprecation_errors'] ? E_ALL : E_ALL & ~E_DEPRECATED);
ini_set('display_errors', true);
ini_set('html_errors', false);
} else {
@@ -377,8 +378,13 @@ function _syslog($priority, $message) {
}
function verbose_error_handler($errno, $errstr, $errfile, $errline) {
global $config;
if (error_reporting() == 0)
return false; // Looks like this warning was suppressed by the @ operator.
if ($errno == E_DEPRECATED && !$config['deprecation_errors'])
return false;
error(utf8tohtml($errstr), true, array(
'file' => $errfile . ':' . $errline,
'errno' => $errno,