From 7030578bbe9e11c18b5becaf8b06e670e3c2e3cd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 01:32:34 -0400 Subject: [ticket/11698] Moving all autoloadable files to phpbb/ PHPBB3-11698 --- phpBB/phpbb/error_collector.php | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 phpBB/phpbb/error_collector.php (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php new file mode 100644 index 0000000000..358da747b8 --- /dev/null +++ b/phpBB/phpbb/error_collector.php @@ -0,0 +1,62 @@ +errors = array(); + } + + function install() + { + set_error_handler(array(&$this, 'error_handler')); + } + + function uninstall() + { + restore_error_handler(); + } + + function error_handler($errno, $msg_text, $errfile, $errline) + { + $this->errors[] = array($errno, $msg_text, $errfile, $errline); + } + + function format_errors() + { + $text = ''; + foreach ($this->errors as $error) + { + if (!empty($text)) + { + $text .= "
\n"; + } + + list($errno, $msg_text, $errfile, $errline) = $error; + + // Prevent leakage of local path to phpBB install + $errfile = phpbb_filter_root_path($errfile); + + $text .= "Errno $errno: $msg_text at $errfile line $errline"; + } + + return $text; + } +} -- cgit v1.2.1 From adc58ba0848a23555044dd76d0b03b9055c81f40 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 16:28:30 -0400 Subject: [ticket/11700] Use a new style constructor for the error collector PHPBB3-11700 --- phpBB/phpbb/error_collector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 358da747b8..0a6462d046 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -19,7 +19,7 @@ class phpbb_error_collector { var $errors; - function phpbb_error_collector() + function __construct() { $this->errors = array(); } -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- phpBB/phpbb/error_collector.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 0a6462d046..9b3216e32f 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_error_collector +class error_collector { var $errors; -- cgit v1.2.1 From 7aa8f6461f1e85cf91931f56b95384e54fec07c2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 Oct 2013 13:05:28 +0100 Subject: [task/code-sniffer] Remove the IN_PHPBB check side-effect from class files. PHPBB3-11980 --- phpBB/phpbb/error_collector.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 9b3216e32f..297972c6b8 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -9,14 +9,6 @@ namespace phpbb; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - class error_collector { var $errors; -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- phpBB/phpbb/error_collector.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 297972c6b8..7141f83174 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1 From a143a19b8bcb3dc4d9b4a20c85776852c30642f2 Mon Sep 17 00:00:00 2001 From: omniError Date: Mon, 10 Nov 2014 18:05:18 -0600 Subject: [ticket/13306] add error level to collector https://tracker.phpbb.com/browse/PHPBB3-13306 PHPBB3-13306 --- phpBB/phpbb/error_collector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 7141f83174..d2a481fc6c 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -24,7 +24,7 @@ class error_collector function install() { - set_error_handler(array(&$this, 'error_handler')); + set_error_handler(array(&$this, 'error_handler'), error_reporting()); } function uninstall() -- cgit v1.2.1 From efd4b43c1bbea587a480c145d8a79066ae78d9a3 Mon Sep 17 00:00:00 2001 From: omniError Date: Tue, 11 Nov 2014 20:20:52 -0600 Subject: [ticket/13306] constructor sets error types https://tracker.phpbb.com/browse/PHPBB3-13306 PHPBB3-13306 --- phpBB/phpbb/error_collector.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index d2a481fc6c..50587cc4ef 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -16,15 +16,27 @@ namespace phpbb; class error_collector { var $errors; + var $error_types; - function __construct() + /** + * Constructor. + * + * The variable $error_types may be set to a mask of PHP error types that + * the collector should keep, e.g. `E_ALL`. If unset, the current value of + * the error_reporting() function will be used to determine which errors + * the collector will keep. + * + * @param int|null $error_types + */ + function __construct($error_types = null) { $this->errors = array(); + $this->error_types = !empty($error_types) ? $error_types : error_reporting(); } function install() { - set_error_handler(array(&$this, 'error_handler'), error_reporting()); + set_error_handler(array(&$this, 'error_handler'), $this->error_types); } function uninstall() -- cgit v1.2.1 From 834a93f76c9b2efe9a4fa89200fe24f844df7479 Mon Sep 17 00:00:00 2001 From: omniError Date: Tue, 11 Nov 2014 20:23:13 -0600 Subject: [ticket/13306] allow 0 error types https://tracker.phpbb.com/browse/PHPBB3-13306 PHPBB3-13306 --- phpBB/phpbb/error_collector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 50587cc4ef..688bc0c422 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -31,7 +31,7 @@ class error_collector function __construct($error_types = null) { $this->errors = array(); - $this->error_types = !empty($error_types) ? $error_types : error_reporting(); + $this->error_types = ($error_types !== null) ? $error_types : error_reporting(); } function install() -- cgit v1.2.1 From 0a4ffb7cf818c399f4956773ff7cb8e5b0243fa3 Mon Sep 17 00:00:00 2001 From: omniError Date: Wed, 12 Nov 2014 16:01:49 -0600 Subject: [ticket/13306] move error_reporting call https://tracker.phpbb.com/browse/PHPBB3-13306 PHPBB3-13306 --- phpBB/phpbb/error_collector.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/error_collector.php') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 688bc0c422..bf8efd1065 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -26,17 +26,18 @@ class error_collector * the error_reporting() function will be used to determine which errors * the collector will keep. * + * @see PHPBB3-13306 * @param int|null $error_types */ function __construct($error_types = null) { $this->errors = array(); - $this->error_types = ($error_types !== null) ? $error_types : error_reporting(); + $this->error_types = $error_types; } function install() { - set_error_handler(array(&$this, 'error_handler'), $this->error_types); + set_error_handler(array(&$this, 'error_handler'), ($this->error_types !== null) ? $this->error_types : error_reporting()); } function uninstall() -- cgit v1.2.1