#51376Show sting values for configured [SYS][exceptionalErrors] and similar codes
Description
There are several configuration options in the install tool that show a numerical representation of PHP error codes:
- [SYS][errorHandlerErrors]
- [SYS][exceptionalErrors]
- [SYS][syslogErrorReporting]
- [SYS][belogErrorReporting]
A viewhelper can be made to translate these numbers to strings, so the admin can see the textual configuration of the current value above the input field.
/**
* Convert PHP error_reporting integer to string
*
* @param $value
* @return array
*/
public static function error2string($value) {
$levelNames = array(
E_ERROR => 'E_ERROR', E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE', E_NOTICE => 'E_NOTICE',
E_CORE_ERROR => 'E_CORE_ERROR', E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR', E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_ERROR => 'E_USER_ERROR', E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE' );
if (defined('E_STRICT')) {
$levelNames[E_STRICT] = 'E_STRICT';
}
$levels = array();
if (($value&E_ALL) == E_ALL) {
$levels[] = 'E_ALL';
$value &= ~E_ALL;
}
foreach ($levelNames as $level => $name) {
if (($value&$level) == $level) {
$levels[] = $name;
}
}
return $levels;
}