Conversation
?T $x = null, not T $x = nulld59e978 to
15318f7
Compare
Al2Klimov
commented
Feb 2, 2026
| { | ||
| $grp = array( | ||
| // addDisplayGroup() uses these names as array indices which must not be null, hence array_filter(). | ||
| $grp = array_filter([ |
Member
Author
There was a problem hiding this comment.
Today I really asked myself why we couldn't just use a statically typed language. Would make so many things easier...
Seriously speaking, I'm pretty sure phpstan would never have caught this. Instead, I did by clicking around in an empty Director and git grep.
Tomorrow, I would fully setup the Director (daemon, kickstart, import...) and continue.
You can already have a look here, though. @lippserd
My setup for reference
configuration.nix
{ lib, pkgs, ... }: let
director = pkgs.fetchFromGitHub {
owner = "Icinga";
repo = "icingaweb2-module-director";
#rev = "v1.11.5";
#hash = "sha256-9La+H+C2hYFXY12leSFj6mmX7+AQ9AIGY7JcGLDFYBQ=";
#rev = "481cf249ba0c105117ae7cccbc1243fc153b5687"; # master
#hash = "sha256-YqrRIVqrvHMtNemC/dhsrA0d3H5VzGVnhSbam0gR2tw=";
rev = "15318f7cac5ccd5459a68702127221eb7454507d"; # nullable
hash = "sha256-/0HGJTHZEpVquDSHcURpegNPxBiBhr4IDiWEuGaDWlA=";
#rev = "b91c747e3959295eee212b7482891fc5efe52771"; # aklimov/nullable
#hash = "sha256-HPqzZA39l7+qos4BIQ/oAQNb62zAYfvdQ/MImvG0g7o=";
};
in {
imports = [
./hardware-configuration.nix
];
boot.tmp.cleanOnBoot = true;
networking.hostName = "aklimov-php85";
networking.domain = "";
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBIroHYGSRaRNFxlK90SS0aHwWjEME30pK5J1N/V1w6a aklimov@ws-aklimov7777777.local'' ];
system.stateVersion = "23.11";
nix.settings.cores = 1;
nix.settings.max-jobs = 1;
swapDevices = [ {
device = "/var/lib/swapfile";
size = 1024;
} ];
services.mysql = with pkgs; {
enable = true;
package = mariadb;
initialDatabases = [
{
name = "iw2";
schema = writeText "schema" ((builtins.readFile "${icingaweb2.src}/schema/mysql.schema.sql") + ''
insert into icingaweb_user values('icingaadmin',1,'$2y$10$38ttWP3MFfQ2c5GtPEdBFuJbmgb9y5Jp9HGxeTYhYDE.5irEFpIfK',now(),now());
'');
}
{
name = "director";
schema = "${director}/schema/mysql.sql";
}
];
ensureUsers = [
{
name = "icingaweb2";
ensurePermissions."iw2.*" = "ALL PRIVILEGES";
ensurePermissions."director.*" = "ALL PRIVILEGES";
}
];
};
services.icingaweb2 = {
enable = true;
generalConfig.global = {
config_resource = "iw2";
module_path = "/etc/icingaweb2/enabledModules";
};
modules.monitoring.enable = false;
authentications = {
mysql = {
backend = "db";
resource = "iw2";
};
};
resources = let
db = name: {
type = "db";
db = "mysql";
host = "localhost";
dbname = name;
username = "icingaweb2";
charset = "utf8mb4";
};
in {
iw2 = db "iw2";
director = db "director";
};
roles = {
adm = {
users = "icingaadmin";
permissions = "*";
};
};
modulePackages = let
withPatches = patches: pkgs: pkg: pkgs.stdenvNoCC.mkDerivation {
name = pkg.name;
src = pkg;
patches = patches;
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
installPhase = ''
mkdir -p $out
cp -r . $out/
'';
};
in {
director = withPatches [ ./director.patch ] pkgs
director;
incubator = pkgs.fetchFromGitHub {
owner = "Icinga";
repo = "icingaweb2-module-incubator";
rev = "v0.23.0";
hash = "sha256-PITM541ASiaL31UiZ7VmKA5YbotrcetIT+9K0PxiSvQ=";
};
};
};
environment.etc."icingaweb2/modules/director/config.ini".text = ''
[db]
resource = "director"
'';
networking.firewall.allowedTCPPorts = [ 80 ];
nixpkgs.overlays = [
(self: prev: let
without = dir: pkgs: src: pkgs.stdenvNoCC.mkDerivation {
name = "without-${dir}";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
${pkgs.rsync}/bin/rsync -a --exclude=${dir} ${src}/ $out/
'';
};
in {
php85 = (import (builtins.fetchTarball {
# https://github.com/NixOS/nixpkgs/pull/422308
url = "https://github.com/drupol/nixpkgs/archive/b0b1ae7d975ceba84c75d1c7260d583d8f89c904.tar.gz";
}) { }).php85.withExtensions ({ enabled, all }: with all; [
bcmath bz2 calendar ctype curl dba decimal ds enchant event excimer exif
ffi fileinfo filter ftp gd gettext gmp iconv inotify intl ldap lexbor
maxminddb mbstring memcached meminfo memprof mongodb msgpack mysqli
mysqlnd openssl opentelemetry pcntl pcov pdlib pdo pdo_dblib pdo_mysql
pdo_odbc pdo_pgsql pdo_sqlite pgsql pinba posix protobuf pspell rdkafka
readline redis session shmop simplexml smbclient snmp soap sockets
sodium sqlite3 sqlsrv ssh2 systemd sysvmsg sysvsem sysvshm tidy
tokenizer uri uuid uv vld wikidiff2 xdebug xml xmlwriter yaml zip zlib
zstd
]);
icingaweb2 = prev.icingaweb2.overrideAttrs (_: {
src = prev.fetchFromGitHub {
owner = "Icinga";
repo = "icingaweb2";
# https://github.com/Icinga/icingaweb2/pull/5454
rev = "be1b54a205e88effa9852ae502b5042e9c4e28f9";
hash = "sha256-tMty6+5jyy6j/CD6bXd8wVs3ChShMPi9op/gysWMhD4=";
};
patches = [
./opcache_reset.patch
./E_ALL.patch
];
});
icingaweb2-ipl = prev.icingaweb2-ipl.overrideAttrs (_: {
src = without "vendor/react/promise" prev
(prev.fetchFromGitHub {
owner = "Icinga";
repo = "icinga-php-library";
# # snapshot/nightly
# rev = "3d91c85c448da7f259e43d1696b158f23f1b00cc";
# hash = "sha256-oDoPnehr4/CG47T1LgCzY1VWqNX1wPbBCAFOf3ZcPAU=";
# aklimov/ipl-html-support-php-85
rev = "1a4c66699045fc0e314be86d0b49fa0f0181949b";
hash = "sha256-ekciv6F5G0vrYdie3/+bkVD/GuB2uIrQyCmISIygbtI=";
});
});
icingaweb2-thirdparty = prev.icingaweb2-thirdparty.overrideAttrs (_: {
src = #without "vendor/react/promise" prev
(prev.fetchFromGitHub {
owner = "Icinga";
repo = "icinga-php-thirdparty";
## aklimov/test/php-85
#rev = "6a529a61dccebf78c651bc4e1ee60baa8490a179";
#hash = "sha256-PRE5j7HLRF/HQwlL0JU/UxcVoaF4BheSg9bHjn7eKIw=";
## aklimov/upgrade-react-promise
#rev = "81daac118f7f800f2264d08a2f49379895df4309";
#hash = "sha256-nucZaF2izLMRd8fwOm0ZI3SWG0/ijplDdXm0dGe2tG8=";
# aklimov/clue-block-react
rev = "ef94e626140fe584677e4fb5ea887d7ce9eab274";
hash = "sha256-2QvTUbKEeXJQJE8FhipIW6LXiMZZ958OdcerSwkNzkI=";
});
});
})
];
services.phpfpm.pools.icingaweb2.phpPackage = lib.mkForce pkgs.php85;
}director.patch
--- a/run.php
+++ b/run.php
@@ -14,2 +13,0 @@ if (! $checker->satisfiesDependencies($this)) {
- include __DIR__ . '/run-missingdeps.php';
- return;E_ALL.patch
--- a/library/Icinga/Application/ApplicationBootstrap.php
+++ b/library/Icinga/Application/ApplicationBootstrap.php
@@ -571 +571 @@ abstract class ApplicationBootstrap
- error_reporting(getenv('ICINGAWEB_ENVIRONMENT') === 'dev' ? E_ALL : E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
+ error_reporting(E_ALL);
--- a/library/Icinga/Application/webrouter.php
+++ b/library/Icinga/Application/webrouter.php
@@ -11 +11 @@ use Icinga\Web\StyleSheet;
-error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
+error_reporting(E_ALL);opcache_reset.patch
--- a/public/index.php
+++ b/public/index.php
@@ -4,1 +4,2 @@
+opcache_reset();
require_once dirname(__DIR__) . '/library/Icinga/Application/webrouter.php';Simply speaking:
- php85: init at 8.5.1 NixOS/nixpkgs#422308
- Support PHP 8.4/8.5 icingaweb2#5454
- Support PHP 8.5 ipl-html#184
composer remove clue/block-reacticinga-php-thirdparty#94- Incubator v0.23.0
- And, of course, this PR
Implicitly marking parameters as nullable is deprecated, the explicit nullable type must be used instead.
Otherwise, PHP complains: Using null as an array offset is deprecated, use an empty string instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Precisely speaking, fix the depreciation warnings they introduced.
TODO