Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a623d1f
Mark parameters defaulting to null as nullable, to avoid PHP8.4+ depr…
BastianLedererIcinga Nov 20, 2025
851f4fa
adjust the names of PDO::MYSQL constants in PHP 8.5 since they are re…
BastianLedererIcinga Nov 21, 2025
b93db92
Remove calls of ReflectionProperty::setAccessible, it is deprecated i…
BastianLedererIcinga Nov 21, 2025
e45fa30
Remove explicit assignment of sid_bits_per_character since changing i…
BastianLedererIcinga Nov 21, 2025
65595e3
Use floor() before casting float to int to avoid PHP 8.5+ warnings fo…
BastianLedererIcinga Nov 24, 2025
bf0758e
fix codestyle
BastianLedererIcinga Nov 24, 2025
ae4c1fe
Replace backtick operator with shell_exec(), because it is deprecated…
BastianLedererIcinga Nov 25, 2025
2ddc88b
Avoid passing null as to array_key_exists() to avoid 8.5+ deprecatio…
BastianLedererIcinga Nov 28, 2025
4edd191
Set sid_bits_per_character to 5 for PHP < 8.4
BastianLedererIcinga Nov 28, 2025
1d57468
Remove unecessary floor() calls
BastianLedererIcinga Nov 28, 2025
2555a92
Remove unecessary guards for null as array key
BastianLedererIcinga Dec 1, 2025
6c913bd
Adjust PHP version in version compare for driver specific PDO constants
BastianLedererIcinga Dec 2, 2025
f528b5f
Replace null as name of an InputElement with an empty string to avoid…
BastianLedererIcinga Dec 5, 2025
9002210
tests: Use latest PHPUnit version
lippserd Dec 12, 2025
c0ad8eb
Assign mySQLInitCommand constant directly
BastianLedererIcinga Dec 15, 2025
c11a88c
Check if backend is null before passing it to strtolower
BastianLedererIcinga Jan 8, 2026
be1b54a
Cleanup phpstan-baseline
BastianLedererIcinga Dec 3, 2025
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
1 change: 0 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
with:
databases: true
php-extensions: ldap
phpunit-version: 9.6
dependencies: |
{
"./icinga-php/ipl" : "https://github.com/Icinga/icinga-php-library.git#snapshot/nightly",
Expand Down
2 changes: 1 addition & 1 deletion application/clicommands/WebCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function stopAction()
{
// TODO: No, that's NOT what we want
$prog = readlink('/proc/self/exe');
`killall $prog`;
shell_exec("killall $prog");
}

protected function forkAndExit()
Expand Down
4 changes: 3 additions & 1 deletion application/forms/Config/Resource/DbResourceForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ public function createElements(array $formData)
)
);
if (isset($formData['use_ssl']) && $formData['use_ssl']) {
if (defined('\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT')) {
if (defined('\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT')
|| defined('Pdo\Mysql::ATTR_SSL_VERIFY_SERVER_CERT')
) {
$this->addElement(
'checkbox',
'ssl_do_not_verify_server_cert',
Expand Down
10 changes: 5 additions & 5 deletions application/forms/RepositoryForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ public function shouldDelete()
/**
* Add a new entry
*
* @param array $data The defaults to use, if any
* @param array|null $data The defaults to use, if any
*
* @return $this
*/
public function add(array $data = null)
public function add(?array $data = null)
{
$this->mode = static::MODE_INSERT;
$this->data = $data;
Expand All @@ -159,12 +159,12 @@ public function add(array $data = null)
/**
* Edit an entry
*
* @param string $name The entry's name
* @param array $data The entry's current data
* @param string $name The entry's name
* @param array|null $data The entry's current data
*
* @return $this
*/
public function edit($name, array $data = null)
public function edit($name, ?array $data = null)
{
$this->mode = static::MODE_UPDATE;
$this->identifier = $name;
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Application/Benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected static function prepareDataForRendering($what = null)
round(($m->timestamp - floor($m->timestamp)) * 1000)
);
$vals = array(
date('H:i:s', (int) $m->timestamp) . '.' . $micro,
date('H:i:s', (int) floor($m->timestamp)) . '.' . $micro,
$m->message
);

Expand Down
4 changes: 2 additions & 2 deletions library/Icinga/Application/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class Config implements Countable, Iterator, Selectable
/**
* Create a new config
*
* @param ConfigObject $config The config object to handle
* @param ConfigObject|null $config The config object to handle
*/
public function __construct(ConfigObject $config = null)
public function __construct(?ConfigObject $config = null)
{
$this->config = $config !== null ? $config : new ConfigObject();
}
Expand Down
25 changes: 13 additions & 12 deletions library/Icinga/Application/Hook/AuditHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ abstract class AuditHook
*
* Propagates the given message details to all known hook implementations.
*
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description possibly referencing parameters in $data
* @param array $data Additional information (How this is stored or used is up to each implementation)
* @param string $identity An arbitrary name identifying the responsible subject, defaults to the current user
* @param int $time A timestamp defining when the activity occurred, defaults to now
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description possibly referencing parameters in $data
* @param array|null $data Additional information (How this is stored or used is up to each implementation)
* @param string $identity An arbitrary name identifying the responsible subject,
* defaults to the current user
* @param int $time A timestamp defining when the activity occurred, defaults to now
*/
public static function logActivity($type, $message, array $data = null, $identity = null, $time = null)
public static function logActivity($type, $message, ?array $data = null, $identity = null, $time = null)
{
if (! Hook::has('audit')) {
return;
Expand Down Expand Up @@ -60,13 +61,13 @@ public static function logActivity($type, $message, array $data = null, $identit
/**
* Log a message to the audit log
*
* @param int $time A timestamp defining when the activity occurred
* @param string $identity An arbitrary name identifying the responsible subject
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description of the activity
* @param array $data Additional activity information
* @param int $time A timestamp defining when the activity occurred
* @param string $identity An arbitrary name identifying the responsible subject
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description of the activity
* @param array|null $data Additional activity information
*/
abstract public function logMessage($time, $identity, $type, $message, array $data = null);
abstract public function logMessage($time, $identity, $type, $message, ?array $data = null);

/**
* Substitute the given message with its accompanying data
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Application/Hook/DbMigrationHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function getLatestMigrations(int $limit): array
*
* @return bool Whether the migration(s) have been successfully applied
*/
final public function run(Connection $conn = null): bool
final public function run(?Connection $conn = null): bool
{
if (! $conn) {
$conn = $this->getDb();
Expand Down
1 change: 1 addition & 0 deletions library/Icinga/Application/Hook/Ticket/TicketPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function offsetExists($offset): bool

public function offsetGet($offset): ?string
{
$offset = $offset ?? '';
return array_key_exists($offset, $this->match) ? $this->match[$offset] : null;
}

Expand Down
8 changes: 4 additions & 4 deletions library/Icinga/Application/MigrationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function applyByName(string $module): bool
*
* @return bool
*/
public function apply(DbMigrationHook $hook, array $elevateConfig = null): bool
public function apply(DbMigrationHook $hook, ?array $elevateConfig = null): bool
{
if ($hook->isModule() && $this->hasMigrations(DbMigrationHook::DEFAULT_MODULE)) {
Logger::error(
Expand Down Expand Up @@ -164,7 +164,7 @@ public function apply(DbMigrationHook $hook, array $elevateConfig = null): bool
*
* @return bool
*/
public function applyAll(array $elevateConfig = null): bool
public function applyAll(?array $elevateConfig = null): bool
{
$default = DbMigrationHook::DEFAULT_MODULE;
if ($this->hasMigrations($default)) {
Expand Down Expand Up @@ -218,7 +218,7 @@ public function getRequiredDatabasePrivileges(): array
*
* @return bool
*/
public function validateDatabasePrivileges(array $elevateConfig = null, bool $canIssueGrant = false): bool
public function validateDatabasePrivileges(?array $elevateConfig = null, bool $canIssueGrant = false): bool
{
if (! $this->hasPendingMigrations()) {
return true;
Expand Down Expand Up @@ -324,7 +324,7 @@ protected function load(): void
*/
protected function checkRequiredPrivileges(
Sql\Connection $conn,
array $elevateConfig = null,
?array $elevateConfig = null,
bool $canIssueGrants = false
): bool {
if ($elevateConfig) {
Expand Down
4 changes: 2 additions & 2 deletions library/Icinga/Application/Modules/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,11 @@ public function listInstalledModules()
/**
* Detect installed modules from every path provided in modulePaths
*
* @param array $availableDirs Installed modules location
* @param array|null $availableDirs Installed modules location
*
* @return $this
*/
public function detectInstalledModules(array $availableDirs = null)
public function detectInstalledModules(?array $availableDirs = null)
{
$modulePaths = $availableDirs !== null ? $availableDirs : $this->modulePaths;
foreach ($modulePaths as $basedir) {
Expand Down
4 changes: 2 additions & 2 deletions library/Icinga/Authentication/AuthChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class AuthChain implements Authenticatable, Iterator
/**
* Create a new authentication chain from config
*
* @param Config $config User backends configuration
* @param Config|null $config User backends configuration
*/
public function __construct(Config $config = null)
public function __construct(?Config $config = null)
{
if ($config === null) {
try {
Expand Down
8 changes: 4 additions & 4 deletions library/Icinga/Authentication/User/DbUserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public function insert($table, array $bind, array $types = array())
/**
* Update table rows with the given data, optionally limited by using a filter
*
* @param string $table
* @param array $bind
* @param Filter $filter
* @param string $table
* @param array $bind
* @param Filter|null $filter
*/
public function update($table, array $bind, Filter $filter = null, array $types = array())
public function update($table, array $bind, ?Filter $filter = null, array $types = array())
{
$this->requireTable($table);
$bind['last_modified'] = date('Y-m-d H:i:s');
Expand Down
16 changes: 8 additions & 8 deletions library/Icinga/Authentication/User/LdapUserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,14 @@ protected function retrieveShadowExpire($value)
/**
* Validate that the requested table exists
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table to validate
* @param RepositoryQuery|null $query An optional query to pass as context
*
* @return string
*
* @throws ProgrammingError In case the given table does not exist
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
public function requireTable($table, ?RepositoryQuery $query = null)
{
if ($query !== null) {
$query->getQuery()->setBase($this->baseDn);
Expand All @@ -356,15 +356,15 @@ public function requireTable($table, RepositoryQuery $query = null)
/**
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery|null $query An optional query to pass as context
*
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
public function requireQueryColumn($table, $name, ?RepositoryQuery $query = null)
{
$column = parent::requireQueryColumn($table, $name, $query);
if ($name === 'user_name' && $query !== null) {
Expand Down
8 changes: 4 additions & 4 deletions library/Icinga/Authentication/User/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ protected static function getCustomUserBackend($identifier)
/**
* Create and return a user backend with the given name and given configuration applied to it
*
* @param string $name
* @param ConfigObject $backendConfig
* @param string $name
* @param ConfigObject|null $backendConfig
*
* @return UserBackendInterface
*
* @throws ConfigurationError
*/
public static function create($name, ConfigObject $backendConfig = null)
public static function create($name, ?ConfigObject $backendConfig = null)
{
if ($backendConfig === null) {
self::assertBackendsExist();
Expand All @@ -181,7 +181,7 @@ public static function create($name, ConfigObject $backendConfig = null)
$name = $backendConfig->name;
}

if (! ($backendType = strtolower($backendConfig->backend))) {
if ($backendConfig->backend === null || ! ($backendType = strtolower($backendConfig->backend))) {
throw new ConfigurationError(
'Authentication configuration for user backend "%s" is missing the \'backend\' directive',
$name
Expand Down
14 changes: 7 additions & 7 deletions library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ public function insert($table, array $bind, array $types = array())
/**
* Update table rows with the given data, optionally limited by using a filter
*
* @param string $table
* @param array $bind
* @param Filter $filter
* @param string $table
* @param array $bind
* @param Filter|null $filter
*/
public function update($table, array $bind, Filter $filter = null, array $types = array())
public function update($table, array $bind, ?Filter $filter = null, array $types = array())
{
$bind['last_modified'] = date('Y-m-d H:i:s');
parent::update($table, $bind, $filter);
Expand All @@ -155,10 +155,10 @@ public function update($table, array $bind, Filter $filter = null, array $types
/**
* Delete table rows, optionally limited by using a filter
*
* @param string $table
* @param Filter $filter
* @param string $table
* @param Filter|null $filter
*/
public function delete($table, Filter $filter = null)
public function delete($table, ?Filter $filter = null)
{
if ($table === 'group') {
parent::delete('group_membership', $filter);
Expand Down
20 changes: 10 additions & 10 deletions library/Icinga/Authentication/UserGroup/LdapUserGroupBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,14 @@ protected function retrieveUserName($dn)
/**
* Validate that the requested table exists
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table to validate
* @param RepositoryQuery|null $query An optional query to pass as context
*
* @return string
*
* @throws ProgrammingError In case the given table does not exist
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
public function requireTable($table, ?RepositoryQuery $query = null)
{
if ($query !== null) {
$query->getQuery()->setBase($this->groupBaseDn);
Expand All @@ -683,15 +683,15 @@ public function requireTable($table, RepositoryQuery $query = null)
/**
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery|null $query An optional query to pass as context
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
* @throws QueryException In case the given column is not a valid query column
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
public function requireQueryColumn($table, $name, ?RepositoryQuery $query = null)
{
$column = parent::requireQueryColumn($table, $name, $query);
if (($name === 'user_name' || $name === 'group_name') && $query !== null) {
Expand Down
8 changes: 4 additions & 4 deletions library/Icinga/Chart/Graph/BarGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class BarGraph extends Styleable implements Drawable
/**
* Create a new BarGraph with the given dataset
*
* @param array $dataSet An array of data points
* @param int $order The graph number displayed by this BarGraph
* @param array $tooltips The tooltips to display for each value
* @param array $dataSet An array of data points
* @param int $order The graph number displayed by this BarGraph
* @param array|null $tooltips The tooltips to display for each value
*/
public function __construct(
array $dataSet,
array &$graphs,
$order,
array $tooltips = null
?array $tooltips = null
) {
$this->order = $order;
$this->dataSet = $dataSet;
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Chart/Graph/LineGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(
array $dataset,
array &$graphs,
$order,
array $tooltips = null
?array $tooltips = null
) {
usort($dataset, array($this, 'sortByX'));
$this->dataset = $dataset;
Expand Down
4 changes: 2 additions & 2 deletions library/Icinga/Chart/Graph/Tooltip.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public function addDataPoint($point)
}

// aggregate y-values
$y = (int)$point[1];
$y = (int)floor($point[1]);
if (isset($point[2])) {
// load original value in case value already aggregated
$y = (int)$point[2];
$y = (int)floor($point[2]);
}

if (!isset($this->data['min']) || $this->data['min'] > $y) {
Expand Down
Loading
Loading