Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion library/Reporting/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ private static function getDb(): RetryConnection

$config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
if ($config->db === 'mysql') {
$config->options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES"
// In PHP 8.5+, driver-specific constants of the PDO class are deprecated,
// but the replacements are only available since php 8.4
if (version_compare(PHP_VERSION, '8.4.0', '<')) {
$mysqlAttrInitCommand = PDO::MYSQL_ATTR_INIT_COMMAND;
} else {
$mysqlAttrInitCommand = Pdo\Mysql::ATTR_INIT_COMMAND;
}
$config->options[$mysqlAttrInitCommand] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES"
. ",NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'";
}

Expand Down
4 changes: 2 additions & 2 deletions library/Reporting/Hook/ReportHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract public function getName();
*
* @return ReportData|null
*/
public function getData(Timerange $timerange, array $config = null)
public function getData(Timerange $timerange, ?array $config = null)
{
return null;
}
Expand All @@ -39,7 +39,7 @@ public function getData(Timerange $timerange, array $config = null)
*
* @return ValidHtml|null
*/
public function getHtml(Timerange $timerange, array $config = null)
public function getHtml(Timerange $timerange, ?array $config = null)
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion library/Reporting/Reports/SystemReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function getName()
return 'System';
}

public function getHtml(Timerange $timerange, array $config = null)
public function getHtml(Timerange $timerange, ?array $config = null)
{
ob_start();
phpinfo();
Expand Down
6 changes: 3 additions & 3 deletions library/Reporting/Web/Forms/ReportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ protected function assemble(): void
'required' => true,
'class' => 'autosubmit',
'label' => $this->translate('Timeframe'),
'options' => [null => $this->translate('Please choose')] + Database::listTimeframes(),
'options' => ['' => $this->translate('Please choose')] + Database::listTimeframes(),
'description' => $this->translate(
'Specifies the time frame in which this report is to be generated'
)
]);

$this->addElement('select', 'template', [
'label' => $this->translate('Template'),
'options' => [null => $this->translate('Please choose')] + Database::listTemplates(),
'options' => ['' => $this->translate('Please choose')] + Database::listTemplates(),
'description' => $this->translate(
'Specifies the template to use when exporting this report to pdf. (Default Icinga template)'
)
Expand All @@ -173,7 +173,7 @@ protected function assemble(): void
'required' => true,
'class' => 'autosubmit',
'label' => $this->translate('Report'),
'options' => [null => $this->translate('Please choose')] + $this->listReports(),
'options' => ['' => $this->translate('Please choose')] + $this->listReports(),
'description' => $this->translate('Specifies the type of the reportlet to be generated')
]);

Expand Down
2 changes: 1 addition & 1 deletion library/Reporting/Web/Forms/ScheduleForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function assemble()
$this->addElement('select', 'action', [
'required' => true,
'class' => 'autosubmit',
'options' => array_merge([null => $this->translate('Please choose')], $this->listActions()),
'options' => array_merge(['' => $this->translate('Please choose')], $this->listActions()),
'label' => $this->translate('Action'),
'description' => $this->translate('Specifies an action to be triggered by the scheduler')
]);
Expand Down
2 changes: 1 addition & 1 deletion library/Reporting/Web/Forms/TemplateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected function addColumnSettings($name, $label)
'class' => 'autosubmit',
'label' => $label,
'options' => [
null => 'None',
'' => 'None',
'text' => 'Text',
'image' => 'Image',
'variable' => 'Variable'
Expand Down
2 changes: 1 addition & 1 deletion library/Reporting/Web/Widget/CompatDropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class CompatDropdown extends Dropdown
{
public function addLink($content, $url, $icon = null, array $attributes = null)
public function addLink($content, $url, $icon = null, ?array $attributes = null)
{
$link = new ActionLink($content, $url, $icon, ['class' => 'dropdown-item']);
if (! empty($attributes)) {
Expand Down
2 changes: 1 addition & 1 deletion library/Reporting/Web/Widget/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Template extends BaseHtmlElement

protected $preview;

public static function getDataUrl(array $image = null)
public static function getDataUrl(?array $image = null)
{
if (empty($image)) {
return 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
Expand Down
Loading
Loading