diff --git a/ecrire/inc/acces.php b/ecrire/inc/acces.php
index 1b687be1bd646b8930aa7fb356c6f360217bdbd7..c56c86a5e7e8f1a902d9829e92f87705aeb57c64 100644
--- a/ecrire/inc/acces.php
+++ b/ecrire/inc/acces.php
@@ -34,14 +34,13 @@ function creer_pass_aleatoire($longueur = 16, $sel = '') {
 	$seed = (int)round(((float)microtime() + 1) * time());
 
 	mt_srand($seed);
-	srand($seed);
 	$s = '';
 	$pass = '';
 	for ($i = 0; $i < $longueur; $i++) {
 		if (!$s) {
-			$s = mt_rand();
+			$s = random_int(0, mt_getrandmax());
 			if (!$s) {
-				$s = rand();
+				$s = random_int(0, mt_getrandmax());
 			}
 			$s = substr(md5(uniqid($s) . $sel), 0, 16);
 		}
@@ -85,13 +84,12 @@ function creer_uniqid() {
 	if (!$seeded) {
 		$seed = (int)round(((float)microtime() + 1) * time());
 		mt_srand($seed);
-		srand($seed);
 		$seeded = true;
 	}
 
-	$s = mt_rand();
+	$s = random_int(0, mt_getrandmax());
 	if (!$s) {
-		$s = rand();
+		$s = random_int(0, mt_getrandmax());
 	}
 
 	return uniqid($s, 1);
@@ -456,5 +454,5 @@ function gerer_htaccess() {
 		}
 	}
 
-	return isset($GLOBALS['meta']['creer_htaccess']) ? $GLOBALS['meta']['creer_htaccess'] : '';
+	return $GLOBALS['meta']['creer_htaccess'] ?? '';
 }
diff --git a/ecrire/inc/auth.php b/ecrire/inc/auth.php
index 76436bc6f0a088d16bf21662e13db98e14d78b17..98131b2272658c798f3ac67d2109069838cdec23 100644
--- a/ecrire/inc/auth.php
+++ b/ecrire/inc/auth.php
@@ -61,7 +61,7 @@ function inc_auth_dist() {
 	$n = intval(sql_errno());
 	spip_log("Erreur base de donnees $n " . sql_error());
 
-	return $n ? $n : 1;
+	return $n ?: 1;
 }
 
 /**
@@ -240,7 +240,7 @@ function auth_init_droits($row) {
 	// reinjecter les preferences_auteur apres le reset de spip_session
 	// car utilisees au retour par auth_loger()
 	$r = @unserialize($row['prefs']);
-	$GLOBALS['visiteur_session']['prefs'] = ($r ? $r : []);
+	$GLOBALS['visiteur_session']['prefs'] = ($r ?: []);
 	// si prefs pas definies, les definir par defaut
 	if (!isset($GLOBALS['visiteur_session']['prefs']['couleur'])) {
 		$GLOBALS['visiteur_session']['prefs']['couleur'] = 2;
@@ -362,7 +362,7 @@ function auth_trace($row, $date = null) {
  */
 function auth_administrer($fonction, $args, $defaut = false) {
 	$auth_methode = array_shift($args);
-	$auth_methode = $auth_methode ? $auth_methode : 'spip'; // valeur par defaut au cas ou
+	$auth_methode = $auth_methode ?: 'spip'; // valeur par defaut au cas ou
 	if (
 		$auth = charger_fonction($auth_methode, 'auth', true)
 		and function_exists($f = "auth_{$auth_methode}_$fonction")
@@ -783,7 +783,7 @@ function ask_php_auth($pb, $raison, $retour = '', $url = '', $re = '', $lien = '
 	$corps = '';
 	$public = generer_url_public();
 	$ecrire = generer_url_ecrire();
-	$retour = $retour ? $retour : _T('icone_retour');
+	$retour = $retour ?: _T('icone_retour');
 	$corps .= "<p>$raison</p>[<a href='$public'>$retour</a>] ";
 	if ($url) {
 		$corps .= "[<a href='" . generer_url_action('cookie', "essai_auth_http=oui&$url") . "'>$re</a>]";
diff --git a/ecrire/inc/autoriser.php b/ecrire/inc/autoriser.php
index a87d0472c8a15d61481da0c1f5f3c8d7281f1955..dc9792048058c4661bfa9f17345b9eb9e926768c 100644
--- a/ecrire/inc/autoriser.php
+++ b/ecrire/inc/autoriser.php
@@ -144,6 +144,7 @@ if ($f = find_in_path('mes_fonctions.php')) {
  */
 function autoriser_dist(string $faire, ?string $type = '', $id = 0, $qui = null, array $opt = []): bool {
 
+	$a = null;
 	// Tolérance avec certains appels de $id (null, '', 'new', 'oui').
 	$id = (int) $id;
 	if ($type === null) {
@@ -153,7 +154,7 @@ function autoriser_dist(string $faire, ?string $type = '', $id = 0, $qui = null,
 	// Qui ? visiteur_session ?
 	// si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge
 	if ($qui === null or $qui === '') {
-		$qui = $GLOBALS['visiteur_session'] ? $GLOBALS['visiteur_session'] : [];
+		$qui = $GLOBALS['visiteur_session'] ?: [];
 		$qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
 	} elseif (is_numeric($qui)) {
 		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
@@ -166,7 +167,7 @@ function autoriser_dist(string $faire, ?string $type = '', $id = 0, $qui = null,
 	}
 
 	spip_log(
-		"autoriser $faire $type $id (" . (isset($qui['nom']) ? $qui['nom'] : '') . ') ?',
+		"autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
 		'autoriser' . _LOG_DEBUG
 	);
 
@@ -183,7 +184,7 @@ function autoriser_dist(string $faire, ?string $type = '', $id = 0, $qui = null,
 		(isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
 		or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
 	) {
-		spip_log("autoriser ($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
+		spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
 		return true;
 	}
 
@@ -216,7 +217,7 @@ function autoriser_dist(string $faire, ?string $type = '', $id = 0, $qui = null,
 	}
 
 	spip_log(
-		"$f($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : ' . ($a ? 'OK' : 'niet'),
+		"$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
 		'autoriser' . _LOG_DEBUG
 	);
 
@@ -1156,7 +1157,7 @@ function liste_rubriques_auteur($id_auteur, $raz = false) {
 			'spip_auteurs_liens',
 			'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
 		)
-		and count($r)
+		and is_countable($r) ? count($r) : 0
 	) {
 		$r = array_column($r, 'id_objet');
 
diff --git a/ecrire/inc/bandeau.php b/ecrire/inc/bandeau.php
index f8b339dd7b6a10cd4abded90489cdf0ec1116407..e3e7cae597c210ab3442d55c5d1030c2df84fc82 100644
--- a/ecrire/inc/bandeau.php
+++ b/ecrire/inc/bandeau.php
@@ -226,7 +226,7 @@ function bandeau_creer_url($url, $args = '', $contexte = null) {
 				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique']));
 			}
 			$val = _request($matches[2], $contexte);
-			$url = parametre_url($url, $matches[1], $val ? $val : '', '&');
+			$url = parametre_url($url, $matches[1], $val ?: '', '&');
 		}
 		$url = str_replace('&', '&amp;', $url);
 	}
diff --git a/ecrire/inc/boutons.php b/ecrire/inc/boutons.php
index 9bc57595f8b41a4b9053f94dc050faa8d676602a..3b8de7b929204438280125ea144708ed13dbe97a 100644
--- a/ecrire/inc/boutons.php
+++ b/ecrire/inc/boutons.php
@@ -138,7 +138,7 @@ function barre_onglets($rubrique, $ongletCourant, $class = 'barre_onglet') {
 	$res = '';
 
 	foreach (definir_barre_onglets($rubrique) as $exec => $onglet) {
-		$url = $onglet->url ? $onglet->url : generer_url_ecrire($exec);
+		$url = $onglet->url ?: generer_url_ecrire($exec);
 		$res .= onglet(_T($onglet->libelle), $url, $exec, $ongletCourant, $onglet->icone);
 	}
 
diff --git a/ecrire/inc/charsets.php b/ecrire/inc/charsets.php
index 3f4a1a9338f049c616bf6572c715777936062b86..ec9c69ec47453c6c327ff3fba4cf2aa43a1ff2c9 100644
--- a/ecrire/inc/charsets.php
+++ b/ecrire/inc/charsets.php
@@ -437,7 +437,7 @@ function charset2unicode($texte, $charset = 'AUTO' /* $forcer: obsolete*/) {
 					}
 				}
 			}
-			if (isset($trans[$charset]) and count($trans[$charset])) {
+			if (isset($trans[$charset]) and is_countable($trans[$charset]) ? count($trans[$charset]) : 0) {
 				return str_replace(array_keys($trans[$charset]), array_values($trans[$charset]), $texte);
 			}
 
@@ -529,6 +529,7 @@ function unicode2charset($texte, $charset = 'AUTO') {
  *     Texte transformé dans le charset site
  **/
 function importer_charset($texte, $charset = 'AUTO') {
+	$s = null;
 	static $trans = [];
 	// on traite le cas le plus frequent iso-8859-1 vers utf directement pour aller plus vite !
 	if (($charset == 'iso-8859-1') && ($GLOBALS['meta']['charset'] == 'utf-8')) {
@@ -554,7 +555,7 @@ function importer_charset($texte, $charset = 'AUTO') {
 				}
 			}
 		}
-		if (count($trans[$charset])) {
+		if (is_countable($trans[$charset]) ? count($trans[$charset]) : 0) {
 			return str_replace(array_keys($trans[$charset]), array_values($trans[$charset]), $texte);
 		}
 
@@ -733,7 +734,7 @@ function caractere_utf_8($num) {
 	if ($num < 65536) {
 		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
 	}
-	if ($num < 1114112) {
+	if ($num < 1_114_112) {
 		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
 	}
 
@@ -902,7 +903,7 @@ function translitteration($texte, $charset = 'AUTO', $complexe = '') {
 	$texte = corriger_caracteres($texte);
 
 	// 1. Passer le charset et les &eacute en utf-8
-	$texte = unicode_to_utf_8(html2unicode(charset2unicode($texte, $charset, true)));
+	$texte = unicode_to_utf_8(html2unicode(charset2unicode($texte, $charset)));
 
 	return translitteration_rapide($texte, $charset, $complexe);
 }
@@ -924,9 +925,7 @@ function translitteration_complexe($texte, $chiffres = false) {
 	if ($chiffres) {
 		$texte = preg_replace_callback(
 			"/[aeiuoyd]['`?~.^+(-]{1,2}/S",
-			function ($m) {
-			return translitteration_chiffree($m[0]);
-			},
+			fn($m) => translitteration_chiffree($m[0]),
 			$texte
 		);
 	}
diff --git a/ecrire/inc/chercher_logo.php b/ecrire/inc/chercher_logo.php
index 0ce95212dc0b11c4d639744f2ce755805e968874..451aa1cb178b35e5084d70e40c447ef5e0b96a3f 100644
--- a/ecrire/inc/chercher_logo.php
+++ b/ecrire/inc/chercher_logo.php
@@ -83,9 +83,7 @@ function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on', $compat_old_logos
  * @deprecated 4.0 MAIS NE PAS SUPPRIMER CAR SERT POUR L'UPGRADE des logos et leur mise en base
  **/
 function type_du_logo($_id_objet) {
-	return isset($GLOBALS['table_logos'][$_id_objet])
-		? $GLOBALS['table_logos'][$_id_objet]
-		: objet_type(preg_replace(',^id_,', '', $_id_objet));
+	return $GLOBALS['table_logos'][$_id_objet] ?? objet_type(preg_replace(',^id_,', '', $_id_objet));
 }
 
 // Exceptions standards (historique)
diff --git a/ecrire/inc/chercher_rubrique.php b/ecrire/inc/chercher_rubrique.php
index 7a8b5a66627306f6bb6b73e3a5cffc919d1a1cb2..00d3a06082116277dfdae6fbdb93d5564aaa84ea 100644
--- a/ecrire/inc/chercher_rubrique.php
+++ b/ecrire/inc/chercher_rubrique.php
@@ -137,7 +137,7 @@ function sous_menu_rubriques($id_rubrique, $root, $niv, &$data, &$enfants, $excl
 	$selected = ($root == $id_rubrique) ? ' selected="selected"' : '';
 
 	// le style en fonction de la profondeur
-	list($class, $style, $espace) = style_menu_rubriques($niv);
+	[$class, $style, $espace] = style_menu_rubriques($niv);
 
 	$class .= ' selec_rub';
 
@@ -195,6 +195,7 @@ function sous_menu_rubriques($id_rubrique, $root, $niv, &$data, &$enfants, $excl
  *     Code HTML du sélecteur
  **/
 function selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem = 0) {
+	$enfants = [];
 	$data = [];
 	if ($type == 'rubrique' and autoriser('publierdans', 'rubrique', 0)) {
 		$data[0] = _T('info_racine_site');
@@ -348,7 +349,7 @@ function construire_selecteur($url, $js, $idom, $name, $init = '', $id = 0) {
 	$icone = (strpos($idom, 'auteur') !== false) ? 'auteur-24.png' : 'rechercher-20.png';
 	// si icone de recherche on embed le svg
 	$balise = ($icone === 'rechercher-20.png' ? chercher_filtre('balise_svg') : chercher_filtre('balise_img'));
-	$img_icone = $balise(chemin_image($icone, _T('titre_image_selecteur')));
+	$img_icone = $balise(chemin_image($icone), _T('titre_image_selecteur'));
 
 	return
 		"<div class='rubrique_actuelle'><a href='#' class='rubrique-search' role='button' style='display:inline-flex;vertical-align:middle;' onclick=\""
diff --git a/ecrire/inc/config.php b/ecrire/inc/config.php
index d9ca628294c5c31accf76e6508b275125e3613d7..111355535d8887fd55dde9c1002f2f7e226e42fa 100644
--- a/ecrire/inc/config.php
+++ b/ecrire/inc/config.php
@@ -127,7 +127,7 @@ function lire_config($cfg = '', $def = null, $unserialize = true) {
 		return $lire_config(substr($cfg, $p + 2), $def, $unserialize);
 	}
 
-	list($table, $casier, $sous_casier) = expliquer_config($cfg);
+	[$table, $casier, $sous_casier] = expliquer_config($cfg);
 
 	if (!isset($GLOBALS[$table])) {
 		return $def;
@@ -145,7 +145,7 @@ function lire_config($cfg = '', $def = null, $unserialize = true) {
 	// ou si on a besoin
 	// d'un sous casier
 	$r = $r[$casier] ?? null;
-	if (($unserialize or count($sous_casier)) and $r and is_string($r)) {
+	if (($unserialize or is_countable($sous_casier) ? count($sous_casier) : 0) and $r and is_string($r)) {
 		$r = (($t = @unserialize($r)) === false ? $r : $t);
 	}
 
@@ -192,7 +192,7 @@ function ecrire_config($cfg, $store) {
 		return $ecrire_config(substr($cfg, $p + 2), $store);
 	}
 
-	list($table, $casier, $sous_casier) = expliquer_config($cfg);
+	[$table, $casier, $sous_casier] = expliquer_config($cfg);
 	// il faut au moins un casier pour ecrire
 	if (!$casier) {
 		return false;
@@ -216,7 +216,7 @@ function ecrire_config($cfg, $store) {
 	if ($c = $sous_casier) {
 		$sc = &$st;
 		$pointeurs = [];
-		while (count($c) and $cc = array_shift($c)) {
+		while (is_countable($c) ? count($c) : 0 and $cc = array_shift($c)) {
 			// creer l'entree si elle n'existe pas
 			if (!isset($sc[$cc])) {
 				// si on essaye d'effacer une config qui n'existe pas
@@ -237,12 +237,12 @@ function ecrire_config($cfg, $store) {
 			// effacer, et remonter pour effacer les parents vides
 			do {
 				unset($pointeurs[$sous][$sous]);
-			} while ($sous = array_pop($c) and !count($pointeurs[$sous][$sous]));
+			} while ($sous = array_pop($c) and !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0));
 
 			// si on a vide tous les sous casiers,
 			// et que le casier est vide
 			// vider aussi la meta
-			if (!$sous and !count($st)) {
+			if (!$sous and !(is_countable($st) ? count($st) : 0)) {
 				$st = null;
 			}
 		} // dans tous les autres cas, on ecrase
@@ -330,7 +330,7 @@ function lister_configurer($exclure = []) {
 	// lister les pages de config deja dans les menus
 	$deja = [];
 	foreach ($exclure as $id => $b) {
-		$url = ($b['url'] ? $b['url'] : $id);
+		$url = ($b['url'] ?: $id);
 		if (!$b['url'] or !isset($exclure[$url])) {
 			if (strncmp($url, 'configurer_', 11) == 0) {
 				$deja[$url] = $b;
diff --git a/ecrire/inc/csv.php b/ecrire/inc/csv.php
index 1a818802ca67a7555db1a959838d884d03f59a12..bde61c557b329d167a4d570d1991befd39358904 100644
--- a/ecrire/inc/csv.php
+++ b/ecrire/inc/csv.php
@@ -79,16 +79,16 @@ function analyse_csv($t) {
 		preg_replace('/[\r\n]+/', "\n", $t)
 	);
 
-	list($entete, $corps) = explode("\n", $t, 2);
+	[$entete, $corps] = explode("\n", $t, 2);
 	$caption = '';
 	// sauter la ligne de tete formee seulement de separateurs
 	if (substr_count($entete, $sep) == strlen($entete)) {
-		list($entete, $corps) = explode("\n", $corps, 2);
+		[$entete, $corps] = explode("\n", $corps, 2);
 	}
 	// si une seule colonne, en faire le titre
 	if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) {
 		$caption = "\n||" . $l[1] . '|';
-		list($entete, $corps) = explode("\n", $corps, 2);
+		[$entete, $corps] = explode("\n", $corps, 2);
 	}
 	// si premiere colonne vide, le raccourci doit quand meme produire <th...
 	if ($entete[0] == $sep) {
diff --git a/ecrire/inc/cvt_configurer.php b/ecrire/inc/cvt_configurer.php
index 135b88707826fefa8f3d6c88a561b03c90a3db71..ba0ac1f327d017977b2e21374c259523a2de6215 100644
--- a/ecrire/inc/cvt_configurer.php
+++ b/ecrire/inc/cvt_configurer.php
@@ -153,7 +153,7 @@ function cvtconf_definir_configurer_conteneur($form, $valeurs) {
 	// car par defaut on utilise ni casier ni prefixe dans ce cas
 	if (isset($valeurs['_meta_table'])) {
 		$table = $valeurs['_meta_table'];
-		$casier = (isset($valeurs['_meta_casier']) ? $valeurs['_meta_casier'] : '');
+		$casier = ($valeurs['_meta_casier'] ?? '');
 	}
 
 	return [$table, $casier, $prefixe, $stockage];
@@ -221,7 +221,7 @@ function cvtconf_formulaires_configurer_recense($form) {
  */
 function cvtconf_configurer_stocker($form, $valeurs, $store) {
 	$trace = '';
-	list($table, $casier, $prefixe, $stockage) = cvtconf_definir_configurer_conteneur($form, $valeurs);
+	[$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
 	// stocker en base
 	// par defaut, dans un casier serialize dans spip_meta (idem CFG)
 	if (!isset($GLOBALS[$table])) {
@@ -249,7 +249,7 @@ function cvtconf_configurer_stocker($form, $valeurs, $store) {
  * @param array $valeurs
  */
 function cvtconf_configurer_lire_meta($form, &$valeurs) {
-	list($table, $casier, $prefixe, $stockage) = cvtconf_definir_configurer_conteneur($form, $valeurs);
+	[$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
 
 	$table = ($table) ? "/$table/" : '';
 	$prefixe = ($prefixe ? $prefixe . '_' : '');
@@ -263,7 +263,7 @@ function cvtconf_configurer_lire_meta($form, &$valeurs) {
 
 	foreach ($valeurs as $k => $v) {
 		if (substr($k, 0, 1) !== '_') {
-			$valeurs[$k] = (isset($meta[$prefixe . $k]) ? $meta[$prefixe . $k] : null);
+			$valeurs[$k] = ($meta[$prefixe . $k] ?? null);
 		}
 	}
 }
diff --git a/ecrire/inc/cvt_multietapes.php b/ecrire/inc/cvt_multietapes.php
index 1e6b591540aeea5de830cb3548c2e7fd3589a1a6..f7c0b6dc4c0e7196315d3f2795e7456262c53942 100644
--- a/ecrire/inc/cvt_multietapes.php
+++ b/ecrire/inc/cvt_multietapes.php
@@ -225,7 +225,7 @@ function cvtmulti_formulaire_verifier_etapes($args, $erreurs) {
 		and ($e = cvtmulti_recuperer_post_precedents($form)) !== false
 	) {
 		// recuperer l'etape saisie et le nombre d'etapes total
-		list($etape, $etapes) = $e;
+		[$etape, $etapes] = $e;
 		$etape_demandee = intval(_request('aller_a_etape')); // possibilite de poster un entier dans aller_a_etape
 
 		$args['etape_saisie'] = $etape;
@@ -255,7 +255,7 @@ function cvtmulti_formulaire_verifier_etapes($args, $erreurs) {
 				]
 			);
 
-			if ($derniere_etape_ok == $e - 1 and !count($erreurs_etapes[$e])) {
+			if ($derniere_etape_ok == $e - 1 and !(is_countable($erreurs_etapes[$e]) ? count($erreurs_etapes[$e]) : 0)) {
 				$derniere_etape_ok = $e;
 			}
 			// possibilite de poster dans _retour_etape_x ou aller_a_etape
@@ -288,7 +288,7 @@ function cvtmulti_formulaire_verifier_etapes($args, $erreurs) {
 			// Ne pas se tromper dans le texte du message d'erreur : la clé '_etapes' n'est pas une erreur !
 			if ($erreurs) {
 				if (!isset($erreurs['message_erreur'])) {
-					$erreurs['message_erreur'] = singulier_ou_pluriel(count($erreurs), 'avis_1_erreur_saisie', 'avis_nb_erreurs_saisie');
+					$erreurs['message_erreur'] = singulier_ou_pluriel(is_countable($erreurs) ? count($erreurs) : 0, 'avis_1_erreur_saisie', 'avis_nb_erreurs_saisie');
 				}
 			} else {
 				$erreurs['message_erreur'] = '';
diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php
index 7c865a4a97cef7a0d7c9cd2b47d3399838f0d38d..21c48f4f69ccf4dd1a235b7f530199f4db1286bb 100644
--- a/ecrire/inc/distant.php
+++ b/ecrire/inc/distant.php
@@ -29,7 +29,7 @@ if (!defined('_INC_DISTANT_USER_AGENT')) {
 	define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')');
 }
 if (!defined('_INC_DISTANT_MAX_SIZE')) {
-	define('_INC_DISTANT_MAX_SIZE', 2097152);
+	define('_INC_DISTANT_MAX_SIZE', 2_097_152);
 }
 if (!defined('_INC_DISTANT_CONNECT_TIMEOUT')) {
 	define('_INC_DISTANT_CONNECT_TIMEOUT', 10);
@@ -39,7 +39,7 @@ define('_REGEXP_COPIE_LOCALE', ',' 	.
 	preg_replace(
 		'@^https?:@',
 		'https?:',
-		(isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : '')
+		($GLOBALS['meta']['adresse_site'] ?? '')
 	)
 	. '/?spip.php[?]action=acceder_document.*file=(.*)$,');
 
@@ -309,7 +309,7 @@ function prepare_donnees_post($donnees, $boundary = '') {
 				}
 			}
 			if ($taille > 500) {
-				$boundary = substr(md5(rand() . 'spip'), 0, 8);
+				$boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8);
 			}
 		}
 
@@ -380,9 +380,7 @@ function url_to_ascii($url_idn) {
 			$url_idn = implode($host_ascii, $url_idn);
 		}
 		// et on urlencode les char utf si besoin dans le path
-		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function ($match) {
- return urlencode($match[0]);
-		}, $url_idn);
+		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', fn($match) => urlencode($match[0]), $url_idn);
 	}
 
 	return $url_idn;
@@ -465,7 +463,7 @@ function recuperer_url($url, $options = []) {
 	}
 
 	if (!empty($options['datas'])) {
-		list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']);
+		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
 		$head .= $head_add;
 		if (stripos($head, 'Content-Length:') === false) {
 			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
@@ -505,7 +503,7 @@ function recuperer_url($url, $options = []) {
 	$refuser_gz = (($options['refuser_gz'] or $copy) ? true : false);
 
 	// ouvrir la connexion et envoyer la requete et ses en-tetes
-	list($handle, $fopen) = init_http(
+	[$handle, $fopen] = init_http(
 		$options['methode'],
 		$url,
 		$refuser_gz,
@@ -582,12 +580,12 @@ function recuperer_url($url, $options = []) {
 
 	$gz = false;
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
-		$gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz');
+		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
 	}
 
 	// si on a pas deja recuperer le contenu par une methode detournee
 	if (!$result['length']) {
-		$res = recuperer_body($handle, $options['taille_max'], $gz ? $gz : $copy);
+		$res = recuperer_body($handle, $options['taille_max'], $gz ?: $copy);
 		fclose($handle);
 		if ($copy) {
 			$result['length'] = $res;
@@ -716,6 +714,7 @@ function recuperer_url_cache($url, $options = []) {
  *   string contenu de la resource
  */
 function recuperer_body($handle, $taille_max = _INC_DISTANT_MAX_SIZE, $fichier = '') {
+	$tmpfile = null;
 	$taille = 0;
 	$result = '';
 	$fp = false;
@@ -782,7 +781,7 @@ function recuperer_entetes_complets($handle, $if_modified_since = false) {
 	while ($s = trim(fgets($handle, 16384))) {
 		$result['headers'][] = $s . "\n";
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
-		list(, $d, $v) = $r;
+		[, $d, $v] = $r;
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
 			$result['location'] = $v;
 		} elseif ($d == 'Last-Modified') {
@@ -1146,7 +1145,7 @@ function need_proxy($host, $http_proxy = null, $http_noproxy = null) {
 	$http_noproxy = " $http_noproxy ";
 	$domain = $host;
 	// si le domaine exact www.example.org est dans les exceptions
-	if (strpos($http_noproxy, " $domain ") !== false) {
+	if (strpos($http_noproxy, (string) " $domain ") !== false) {
 		return '';
 	}
 
@@ -1156,7 +1155,7 @@ function need_proxy($host, $http_proxy = null, $http_noproxy = null) {
 		$domain = implode('.', $domain);
 
 		// ou si un domaine parent commencant par un . est dans les exceptions (indiquant qu'il couvre tous les sous-domaines)
-		if (strpos($http_noproxy, " .$domain ") !== false) {
+		if (strpos($http_noproxy, (string) " .$domain ") !== false) {
 			return '';
 		}
 	}
@@ -1390,7 +1389,7 @@ function lance_requete(
 
 #	spip_log("Requete\n$req", 'distant');
 	fputs($f, $req);
-	fputs($f, $datas ? $datas : "\r\n");
+	fputs($f, $datas ?: "\r\n");
 
 	return $f;
 }
diff --git a/ecrire/inc/documents.php b/ecrire/inc/documents.php
index 3ff76b88f17a683e609169b6d7b5d5849ed7b73e..aa64d6561a957f334077133ba77b5b2134ae1d72 100644
--- a/ecrire/inc/documents.php
+++ b/ecrire/inc/documents.php
@@ -30,7 +30,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  * @return string
  */
 function set_spip_doc(?string $fichier): string {
-	if ($fichier and strpos($fichier, _DIR_IMG) === 0) {
+	if ($fichier and strpos($fichier, (string) _DIR_IMG) === 0) {
 		return substr($fichier, strlen(_DIR_IMG));
 	} else {
 		// ex: fichier distant
@@ -141,7 +141,7 @@ function effacer_repertoire_temporaire($nom) {
 function copier_document($ext, $orig, $source, $subdir = null) {
 
 	$orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc
-	$dir = creer_repertoire_documents($subdir ? $subdir : $ext);
+	$dir = creer_repertoire_documents($subdir ?: $ext);
 
 	$dest = preg_replace('/<[^>]*>/', '', basename($orig));
 	$dest = preg_replace('/\.([^.]+)$/', '', $dest);
diff --git a/ecrire/inc/editer.php b/ecrire/inc/editer.php
index 422a5fdeadc4b09686d66a18753a5b55660aca5b..9183c4686595b055b10f18c1341c3d2f86c7865d 100644
--- a/ecrire/inc/editer.php
+++ b/ecrire/inc/editer.php
@@ -73,15 +73,15 @@ function formulaires_editer_objet_traiter(
 	// eviter la redirection forcee par l'action...
 	set_request('redirect');
 	if ($action_editer = charger_fonction("editer_$type", 'action', true)) {
-		list($id, $err) = $action_editer($id);
+		[$id, $err] = $action_editer($id);
 	} else {
 		$action_editer = charger_fonction('editer_objet', 'action');
-		list($id, $err) = $action_editer($id, $type);
+		[$id, $err] = $action_editer($id, $type);
 	}
 	$id_table_objet = id_table_objet($type);
 	$res[$id_table_objet] = $id;
 	if ($err or !$id) {
-		$res['message_erreur'] = ($err ? $err : _T('erreur'));
+		$res['message_erreur'] = ($err ?: _T('erreur'));
 	} else {
 		// Un lien de trad a prendre en compte
 		if ($lier_trad) {
@@ -135,7 +135,7 @@ function formulaires_editer_objet_verifier($type, $id = 'new', $oblis = []) {
 	$erreurs = [];
 	if (intval($id)) {
 		$conflits = controler_contenu($type, $id);
-		if ($conflits and count($conflits)) {
+		if ($conflits and is_countable($conflits) ? count($conflits) : 0) {
 			foreach ($conflits as $champ => $conflit) {
 				if (!isset($erreurs[$champ])) {
 					$erreurs[$champ] = '';
@@ -209,6 +209,7 @@ function formulaires_editer_objet_charger(
 	$hidden = ''
 ) {
 
+	$valeurs = [];
 	$table_objet = table_objet($type);
 	$table_objet_sql = table_objet_sql($type);
 	$id_table_objet = id_table_objet($type);
@@ -300,7 +301,7 @@ function formulaires_editer_objet_charger(
 		. ($config['lignes'] + 15)
 		. "' cols='40'";
 	if (isset($contexte['texte'])) {
-		list($contexte['texte'], $contexte['_texte_trop_long']) = editer_texte_recolle($contexte['texte'], $att_text);
+		[$contexte['texte'], $contexte['_texte_trop_long']] = editer_texte_recolle($contexte['texte'], $att_text);
 	}
 
 	// on veut conserver la langue de l'interface ;
@@ -320,7 +321,7 @@ function formulaires_editer_objet_charger(
 				$lang_default .
 				"' />"))
 		. $hidden
-		. (isset($md5) ? $md5 : '');
+		. ($md5 ?? '');
 
 	// preciser que le formulaire doit passer dans un pipeline
 	$contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]];
@@ -400,7 +401,7 @@ function editer_texte_recolle($texte, $att_text) {
 
 	while (strlen($texte) > 29 * 1024) {
 		$nombre++;
-		list($texte1, $texte) = coupe_trop_long($texte);
+		[$texte1, $texte] = coupe_trop_long($texte);
 		$textes_supplement .= '<br />' .
 			"<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n";
 	}
@@ -597,7 +598,7 @@ function controler_contenu($type, $id, $options = [], $c = false, $serveur = '')
 				'spip_table_objet' => $spip_table_objet,
 				'type' => $type,
 				'id_objet' => $id,
-				'champs' => isset($options['champs']) ? $options['champs'] : [], // [doc] c'est quoi ?
+				'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
 				'action' => 'controler',
 				'serveur' => $serveur,
 			],
@@ -610,7 +611,7 @@ function controler_contenu($type, $id, $options = [], $c = false, $serveur = '')
 	}
 
 	// Verifier si les mises a jour sont pertinentes, datees, en conflit etc
-	$conflits = controler_md5($champs, $_POST, $type, $id, $serveur, isset($options['prefix']) ? $options['prefix'] : 'ctr_');
+	$conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_');
 
 	return $conflits;
 }
@@ -763,7 +764,7 @@ function signaler_conflits_edition($conflits, $redirect = '') {
 	}
 
 	if ($redirect) {
-		$id = uniqid(rand());
+		$id = uniqid(random_int(0, mt_getrandmax()));
 		$redirect = "<form action='$redirect' method='get'
 			id='$id'
 			style='float:" . $GLOBALS['spip_lang_right'] . "; margin-top:2em;'>\n"
diff --git a/ecrire/inc/envoyer_mail.php b/ecrire/inc/envoyer_mail.php
index 758f5c74d21c1ba0ca1194cfcf4f32386629b66e..2b5b34cc0c84cd669f6757e49c3fc4aa250ecfda 100644
--- a/ecrire/inc/envoyer_mail.php
+++ b/ecrire/inc/envoyer_mail.php
@@ -116,8 +116,8 @@ function inc_envoyer_mail_dist($destinataire, $sujet, $corps, $from = '', $heade
 	$parts = '';
 	if (is_array($corps)) {
 		$texte = $corps['texte'];
-		$from = (isset($corps['from']) ? $corps['from'] : $from);
-		$headers = (isset($corps['headers']) ? $corps['headers'] : $headers);
+		$from = ($corps['from'] ?? $from);
+		$headers = ($corps['headers'] ?? $headers);
 		if (is_array($headers)) {
 			$headers = implode("\n", $headers);
 		}
@@ -157,7 +157,7 @@ function inc_envoyer_mail_dist($destinataire, $sujet, $corps, $from = '', $heade
 		$texte = wordwrap($texte);
 	}
 
-	list($headers, $texte) = mail_normaliser_headers($headers, $from, $destinataire, $texte, $parts);
+	[$headers, $texte] = mail_normaliser_headers($headers, $from, $destinataire, $texte, $parts);
 
 	if (_OS_SERVEUR == 'windows') {
 		$texte = preg_replace("@\r*\n@", "\r\n", $texte);
@@ -209,7 +209,7 @@ function mail_normaliser_headers($headers, $from, $to, $texte, $parts = '') {
 	else {
 		$domain = '@unknown-' . md5($from) . '.org';
 	}
-	$uniq = rand() . '_' . md5($to . $texte) . $domain;
+	$uniq = random_int(0, mt_getrandmax()) . '_' . md5($to . $texte) . $domain;
 
 	// Si multi-part, s'en servir comme borne ...
 	if ($parts) {
diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php
index 57fb31dc4534e4e68bc0154f228b758d02b16e86..3129508f2fe6aca203de15186f585500224af0cd 100644
--- a/ecrire/inc/filtres.php
+++ b/ecrire/inc/filtres.php
@@ -271,7 +271,7 @@ function decrire_version_svn($dir) {
 		$dir = '.';
 	}
 	// version installee par SVN
-	if (file_exists($dir . '/.svn/wc.db') && class_exists('SQLite3')) {
+	if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) {
 		$db = new SQLite3($dir . '/.svn/wc.db');
 		$result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1');
 		if ($result) {
@@ -635,7 +635,7 @@ function taille_image($img, $force_refresh = false) {
 		elseif (strpos($src, '<svg') !== false) {
 			include_spip('inc/svg');
 			if ($attrs = svg_lire_attributs($src)) {
-				list($width, $height, $viewbox) = svg_getimagesize_from_attr($attrs);
+				[$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs);
 				if (!$srcWidth) {
 					$largeur_img[$src] = $srcWidth = $width;
 				}
@@ -681,7 +681,7 @@ function largeur($img) {
 	if (!$img) {
 		return;
 	}
-	list($h, $l) = taille_image($img);
+	[$h, $l] = taille_image($img);
 
 	return $l;
 }
@@ -703,7 +703,7 @@ function hauteur($img) {
 	if (!$img) {
 		return;
 	}
-	list($h, $l) = taille_image($img);
+	[$h, $l] = taille_image($img);
 
 	return $h;
 }
@@ -1531,7 +1531,7 @@ function choixsiegal($a1, $a2, $v, $f) {
 function filtrer_ical($texte) {
 	#include_spip('inc/charsets');
 	$texte = html2unicode($texte);
-	$texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset'], 1), 'utf-8');
+	$texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset']), 'utf-8');
 	$texte = preg_replace("/\n/", ' ', $texte);
 	$texte = preg_replace('/,/', '\,', $texte);
 
@@ -1817,6 +1817,7 @@ function extraire_multi($letexte, $lang = null, $options = []) {
  *     Peut retourner un code de langue vide, lorsqu'un texte par défaut est indiqué.
  **/
 function extraire_trads($bloc) {
+	$trads = [];
 	$lang = '';
 // ce reg fait planter l'analyse multi s'il y a de l'{italique} dans le champ
 //	while (preg_match("/^(.*?)[{\[]([a-z_]+)[}\]]/siS", $bloc, $regs)) {
@@ -1904,7 +1905,7 @@ function unique($donnee, $famille = '', $cpt = false) {
 		$mem[$famille] = [];
 	}
 	if ($cpt) {
-		return count($mem[$famille]);
+		return is_countable($mem[$famille]) ? count($mem[$famille]) : 0;
 	}
 	// eviter une notice
 	if (!isset($mem[$famille][$donnee])) {
@@ -2068,7 +2069,7 @@ function inserer_attribut(string $balise, string $attribut, string $val, bool $p
 		$insert = " $attribut='$val'";
 	}
 
-	list($old, $r) = extraire_attribut($balise, $attribut, true);
+	[$old, $r] = extraire_attribut($balise, $attribut, true);
 
 	if ($old !== null) {
 		// Remplacer l'ancien attribut du meme nom
@@ -2133,7 +2134,7 @@ function modifier_class($balise, $class, $operation = 'ajouter') {
 		$is_class_presente = false;
 		if (
 			$class_courante
-			and strpos($class_courante, $c) !== false
+			and strpos($class_courante, (string) $c) !== false
 			and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante)
 		) {
 			$is_class_presente = true;
@@ -2338,6 +2339,8 @@ function modulo($nb, $mod, $add = 0) {
  *      - true sinon
  **/
 function nom_acceptable($nom) {
+	$remp2 = [];
+	$remp1 = [];
 	if (!is_string($nom)) {
 		return false;
 	}
@@ -2430,7 +2433,7 @@ function afficher_tags($tags, $rels = 'tag,directory') {
 	$s = [];
 	foreach (extraire_balises($tags, 'a') as $tag) {
 		$rel = extraire_attribut($tag, 'rel');
-		if (strstr(",$rels,", ",$rel,")) {
+		if (strstr(",$rels,", (string) ",$rel,")) {
 			$s[] = $tag;
 		}
 	}
@@ -2792,7 +2795,7 @@ function form_hidden($action) {
 	// puis on rassemble le tout
 	$hidden = [];
 	foreach ($values as $value) {
-		list($var, $val) = $value;
+		[$var, $val] = $value;
 		$hidden[] = '<input name="'
 			. entites_html($var)
 			. '"'
@@ -2910,9 +2913,7 @@ function urls_absolues_css($contenu, $source) {
 
 	return preg_replace_callback(
 		",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
-		function ($x) use ($path) {
-			return "url('" . suivre_lien($path, $x[1]) . "')";
-		},
+		fn($x) => "url('" . suivre_lien($path, $x[1]) . "')",
 		$contenu
 	);
 }
@@ -3505,7 +3506,7 @@ function http_img_pack($img, $alt, $atts = '', $title = '', $options = []) {
 			$largeur = $hauteur = intval($regs[1]);
 		} else {
 			$taille = taille_image($img_file);
-			list($hauteur, $largeur) = $taille;
+			[$hauteur, $largeur] = $taille;
 			if (!$hauteur or !$largeur) {
 				return '';
 			}
@@ -3584,7 +3585,7 @@ function helper_filtre_balise_img_svg_size($img, $size) {
 	// si size est de la forme '@2x' c'est un coeff multiplicateur sur la densite
 	if (strpos($size, '@') === 0 and substr($size, -1) === 'x') {
 		$coef = floatval(substr($size, 1, -1));
-		list($h, $w) = taille_image($img);
+		[$h, $w] = taille_image($img);
 		$height = intval(round($h / $coef));
 		$width = intval(round($w / $coef));
 	}
@@ -3597,7 +3598,7 @@ function helper_filtre_balise_img_svg_size($img, $size) {
 		if (count($size) and reset($size)) {
 			$height = array_shift($size);
 			if ($height === '*') {
-				list($h, $w) = taille_image($img);
+				[$h, $w] = taille_image($img);
 				$height = intval(round($h * $width / $w));
 			}
 		}
@@ -3639,7 +3640,7 @@ function helper_filtre_balise_img_svg_size($img, $size) {
  */
 function filtre_balise_img_dist($img, $alt = '', $class = null, $size = null) {
 
-	list($alt, $class, $size) = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
+	[$alt, $class, $size] = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
 
 	$img = trim($img);
 	if (strpos($img, '<img') === 0) {
@@ -3669,7 +3670,7 @@ function filtre_balise_img_dist($img, $alt = '', $class = null, $size = null) {
 	}
 
 	if ($img and !is_null($size) and strlen($size = trim($size))) {
-		list($width, $height) = helper_filtre_balise_img_svg_size($img, $size);
+		[$width, $height] = helper_filtre_balise_img_svg_size($img, $size);
 
 		$img = inserer_attribut($img, 'width', $width);
 		$img = inserer_attribut($img, 'height', $height);
@@ -3709,6 +3710,7 @@ function filtre_balise_img_dist($img, $alt = '', $class = null, $size = null) {
  */
 function filtre_balise_svg_dist($img, $alt = '', $class = null, $size = null) {
 
+	$svg = null;
 	$img = trim($img);
 	$img_file = $img;
 	if (strpos($img, '<svg') === false) {
@@ -3737,7 +3739,7 @@ function filtre_balise_svg_dist($img, $alt = '', $class = null, $size = null) {
 		return '';
 	}
 
-	list($alt, $class, $size) = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
+	[$alt, $class, $size] = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
 
 	$balise_svg = $match[0];
 	$balise_svg_source = $balise_svg;
@@ -3773,7 +3775,7 @@ function filtre_balise_svg_dist($img, $alt = '', $class = null, $size = null) {
 	$svg = str_replace($balise_svg_source, $balise_svg, $svg);
 
 	if (!is_null($size) and strlen($size = trim($size))) {
-		list($width, $height) = helper_filtre_balise_img_svg_size($svg, $size);
+		[$width, $height] = helper_filtre_balise_img_svg_size($svg, $size);
 
 		if (!function_exists('svg_redimensionner')) {
 			include_spip('inc/svg');
@@ -3971,6 +3973,7 @@ function filtre_puce_statut_dist($statut, $objet, $id_objet = 0, $id_parent = 0)
  *   hash du contexte
  */
 function encoder_contexte_ajax($c, $form = '', $emboite = null, $ajaxid = '') {
+	$env = null;
 	if (
 		is_string($c)
 		and @unserialize($c) !== false
@@ -4331,7 +4334,7 @@ function prepare_icone_base($type, $lien, $texte, $fond, $fonction = '', $class
 	$fond_origine = $fond;
 	// Remappage des icone : article-24.png+new => article-new-24.png
 	if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) {
-		list($fond, $fonction) = $icone_renommer($fond, $fonction);
+		[$fond, $fonction] = $icone_renommer($fond, $fonction);
 	}
 
 	// Ajouter le type d'objet dans la classe
@@ -4756,7 +4759,7 @@ function generer_info_entite($id_objet, $type_objet, $info, $etoile = '', $param
 			$info_generee = $generer($id_objet, $type_objet, $objets[$type_objet][$id_objet], ...$params);
 		} // Sinon on prend directement le champ SQL tel quel
 		else {
-			$info_generee = (isset($objets[$type_objet][$id_objet][$info]) ? $objets[$type_objet][$id_objet][$info] : '');
+			$info_generee = ($objets[$type_objet][$id_objet][$info] ?? '');
 		}
 	}
 
@@ -5011,7 +5014,7 @@ function objet_info($objet, $info) {
 	$table = table_objet_sql($objet);
 	$infos = lister_tables_objets_sql($table);
 
-	return (isset($infos[$info]) ? $infos[$info] : '');
+	return ($infos[$info] ?? '');
 }
 
 /**
@@ -5147,7 +5150,7 @@ function produire_fond_statique($fond, $contexte = [], $options = [], string $co
 	else {
 		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
 		ksort($contexte);
-		$hash = md5($fond . json_encode($contexte_implicite) . json_encode($contexte) . $connect);
+		$hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
 	}
 	$filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
 
@@ -5430,9 +5433,9 @@ function spip_affiche_mot_de_passe_masque($passe, $afficher_partiellement = fals
 function identifiant_slug($texte, $type = '', $options = []) {
 
 	$original = $texte;
-	$separateur = (isset($options['separateur']) ? $options['separateur'] : '_');
-	$longueur_maxi = (isset($options['longueur_maxi']) ? $options['longueur_maxi'] : 60);
-	$longueur_mini = (isset($options['longueur_mini']) ? $options['longueur_mini'] : 0);
+	$separateur = ($options['separateur'] ?? '_');
+	$longueur_maxi = ($options['longueur_maxi'] ?? 60);
+	$longueur_mini = ($options['longueur_mini'] ?? 0);
 
 	if (!function_exists('translitteration')) {
 		include_spip('inc/charsets');
@@ -5455,7 +5458,7 @@ function identifiant_slug($texte, $type = '', $options = []) {
 	$texte = preg_replace(',[\W_]+,ms', $separateur, $texte);
 
 	// nettoyer les doubles occurences du separateur si besoin
-	while (strpos($texte, "$separateur$separateur") !== false) {
+	while (strpos($texte, (string) "$separateur$separateur") !== false) {
 		$texte = str_replace("$separateur$separateur", $separateur, $texte);
 	}
 
@@ -5544,7 +5547,7 @@ function helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, $fonct
 
 	// compatibilite signature inversee
 	if (is_numeric($objet) and !is_numeric($id_objet)) {
-		list($objet, $id_objet) = [$id_objet, $objet];
+		[$objet, $id_objet] = [$id_objet, $objet];
 	}
 
 	if (!function_exists($fonction)) {
diff --git a/ecrire/inc/filtres_alertes.php b/ecrire/inc/filtres_alertes.php
index e1b6eef91e0f453df37c64766329c6f0e91c7c2c..78f5dee93a62429d56dc91c7d40b01b768cd0d29 100644
--- a/ecrire/inc/filtres_alertes.php
+++ b/ecrire/inc/filtres_alertes.php
@@ -48,7 +48,7 @@ function balise_ALERTE_MESSAGE_dist($p) {
 	$_class = interprete_argument_balise(3, $p);
 	$_role  = interprete_argument_balise(4, $p);
 	$_id    = interprete_argument_balise(5, $p);
-	$_texte = ($_texte ? $_texte     : "''");
+	$_texte = ($_texte ?: "''");
 	$_titre = ($_titre ? ", $_titre" : ', null');
 	$_class = ($_class ? ", $_class" : ', null');
 	$_role  = ($_role  ? ", $_role"  : ', null');
@@ -201,8 +201,8 @@ function message_alerte_ouvrir(?string $titre = null, ?string $class = null, ?st
 	$prive = test_espace_prive();
 
 	// Valeurs par défaut
-	$role = $role ?? 'alert'; // fallback uniquement si null
-	$class = $class ?? 'notice'; // fallback uniquement si null
+	$role ??= 'alert'; // fallback uniquement si null
+	$class ??= 'notice'; // fallback uniquement si null
 
 	// Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
 	$types = [
diff --git a/ecrire/inc/filtres_boites.php b/ecrire/inc/filtres_boites.php
index 0bbd13886a0842402d6b385aaa9531f6a1640943..d044f4d301483786e189d301bb13c054d5a6107d 100644
--- a/ecrire/inc/filtres_boites.php
+++ b/ecrire/inc/filtres_boites.php
@@ -47,7 +47,7 @@ function balise_BOITE_OUVRIR_dist($p) {
 	$_titre = interprete_argument_balise(1, $p);
 	$_class = interprete_argument_balise(2, $p);
 	$_head_class = interprete_argument_balise(3, $p);
-	$_titre = ($_titre ? $_titre : "''");
+	$_titre = ($_titre ?: "''");
 	$_class = ($_class ? ", $_class" : ", 'simple'");
 	$_head_class = ($_head_class ? ", $_head_class" : '');
 
diff --git a/ecrire/inc/filtres_dates.php b/ecrire/inc/filtres_dates.php
index 8eeca38357c9fea890de23be12a61bc399b1ad10..2ee707c6dca8564adeddf4d9dfe173dd7a931ae1 100644
--- a/ecrire/inc/filtres_dates.php
+++ b/ecrire/inc/filtres_dates.php
@@ -148,9 +148,10 @@ function recup_heure($date) {
  * @return int heures, sinon 0
  **/
 function heures($numdate) {
+	$heures = null;
 	$date_array = recup_heure($numdate);
 	if ($date_array) {
-		list($heures, $minutes, $secondes) = $date_array;
+		[$heures, $minutes, $secondes] = $date_array;
 	}
 
 	return $heures;
@@ -167,9 +168,10 @@ function heures($numdate) {
  * @return int minutes, sinon 0
  **/
 function minutes($numdate) {
+	$minutes = null;
 	$date_array = recup_heure($numdate);
 	if ($date_array) {
-		list($heures, $minutes, $secondes) = $date_array;
+		[$heures, $minutes, $secondes] = $date_array;
 	}
 
 	return $minutes;
@@ -186,9 +188,10 @@ function minutes($numdate) {
  * @return int secondes, sinon 0
  **/
 function secondes($numdate) {
+	$secondes = null;
 	$date_array = recup_heure($numdate);
 	if ($date_array) {
-		list($heures, $minutes, $secondes) = $date_array;
+		[$heures, $minutes, $secondes] = $date_array;
 	}
 
 	return $secondes;
@@ -253,17 +256,17 @@ function recup_date($numdate, $forcer_jour = true) {
 		} elseif ($annee < 100) {
 			$annee = 1900 + $annee;
 		}
-		list($heures, $minutes, $secondes) = recup_heure($numdate);
+		[$heures, $minutes, $secondes] = recup_heure($numdate);
 	} elseif (preg_match('#([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})#', $numdate, $regs)) {
 		$annee = $regs[1];
 		$mois = $regs[2];
 		$jour = $regs[3];
-		list($heures, $minutes, $secondes) = recup_heure($numdate);
+		[$heures, $minutes, $secondes] = recup_heure($numdate);
 	} elseif (preg_match('#([0-9]{4})-([0-9]{2})#', $numdate, $regs)) {
 		$annee = $regs[1];
 		$mois = $regs[2];
 		$jour = '';
-		list($heures, $minutes, $secondes) = recup_heure($numdate);
+		[$heures, $minutes, $secondes] = recup_heure($numdate);
 	} elseif (preg_match('#^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $numdate, $regs)) {
 		$annee = $regs[1];
 		$mois = $regs[2];
@@ -507,7 +510,7 @@ function affdate_base($numdate, $vue, $options = []) {
 	if (!$date_array) {
 		return;
 	}
-	list($annee, $mois, $jour, $heures, $minutes, $secondes) = $date_array;
+	[$annee, $mois, $jour, $heures, $minutes, $secondes] = $date_array;
 
 	// 1er, 21st, etc.
 	$journum = $jour;
@@ -662,7 +665,7 @@ function affdate_base($numdate, $vue, $options = []) {
 		// Cas d'une vue non definie : retomber sur le format
 		// de date propose par http://www.php.net/date
 		default:
-			list($annee, $mois, $jour, $heures, $minutes, $secondes) = $date_array;
+			[$annee, $mois, $jour, $heures, $minutes, $secondes] = $date_array;
 			if (!$time = mktime($heures, $minutes, $secondes, $mois, (int) $jour, $annee)) {
 				$time = strtotime($numdate);
 			}
@@ -991,7 +994,7 @@ function affdate_heure($numdate) {
 	if (!$date_array) {
 		return;
 	}
-	list($annee, $mois, $jour, $heures, $minutes, $sec) = $date_array;
+	[$annee, $mois, $jour, $heures, $minutes, $sec] = $date_array;
 
 	return _T('date_fmt_jour_heure', [
 		'jour' => affdate($numdate),
@@ -1159,8 +1162,8 @@ function affdate_debut_fin($date_debut, $date_fin, $horaire = 'oui', $forme = ''
  *     Date au format ical
  **/
 function date_ical($date, $addminutes = 0) {
-	list($heures, $minutes, $secondes) = recup_heure($date);
-	list($annee, $mois, $jour) = recup_date($date);
+	[$heures, $minutes, $secondes] = recup_heure($date);
+	[$annee, $mois, $jour] = recup_date($date);
 
 	return gmdate('Ymd\THis\Z', mktime($heures, $minutes + $addminutes, $secondes, $mois, $jour, $annee));
 }
@@ -1186,8 +1189,8 @@ function date_ical($date, $addminutes = 0) {
  *     La date formatée
  **/
 function date_iso($date_heure) {
-	list($annee, $mois, $jour) = recup_date($date_heure);
-	list($heures, $minutes, $secondes) = recup_heure($date_heure);
+	[$annee, $mois, $jour] = recup_date($date_heure);
+	[$heures, $minutes, $secondes] = recup_heure($date_heure);
 	$time = @mktime($heures, $minutes, $secondes, $mois, $jour, $annee);
 
 	return gmdate('Y-m-d\TH:i:s\Z', $time);
@@ -1213,8 +1216,8 @@ function date_iso($date_heure) {
  *     La date formatée
  **/
 function date_822($date_heure) {
-	list($annee, $mois, $jour) = recup_date($date_heure);
-	list($heures, $minutes, $secondes) = recup_heure($date_heure);
+	[$annee, $mois, $jour] = recup_date($date_heure);
+	[$heures, $minutes, $secondes] = recup_heure($date_heure);
 	$time = mktime($heures, $minutes, $secondes, $mois, $jour, $annee);
 
 	return date('r', $time);
diff --git a/ecrire/inc/filtres_ecrire.php b/ecrire/inc/filtres_ecrire.php
index 70b88319cc6f0ae380cf44bf1f962ebf20d6e0e4..4fb7fe87e980ed32d3a1c8c05be2b7f281f66940 100644
--- a/ecrire/inc/filtres_ecrire.php
+++ b/ecrire/inc/filtres_ecrire.php
@@ -166,7 +166,7 @@ function chercher_rubrique(
 
 	include_spip('inc/presentation');
 
-	return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur(true);
+	return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur();
 }
 
 
@@ -386,7 +386,7 @@ function auteurs_lister_statuts($quoi = 'tous', $en_base = true) {
 function trouver_rubrique_creer_objet($id_rubrique, $objet) {
 
 	if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) {
-		$in = !count($GLOBALS['connect_id_rubrique'])
+		$in = !(is_countable($GLOBALS['connect_id_rubrique']) ? count($GLOBALS['connect_id_rubrique']) : 0)
 			? ''
 			: (' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']));
 
@@ -587,7 +587,7 @@ function afficher_plus_info($lien, $titre = '+', $titre_lien = '') {
  */
 function lister_objets_lies($objet_source, $objet, $id_objet, $objet_lien) {
 	$res = lister_objets_liens($objet_source, $objet, $id_objet, $objet_lien);
-	if (!count($res)) {
+	if (!(is_countable($res) ? count($res) : 0)) {
 		return [];
 	}
 	$r = reset($res);
diff --git a/ecrire/inc/filtres_images_lib_mini.php b/ecrire/inc/filtres_images_lib_mini.php
index a92560c4a017bb6b3cb2e2a572be6bbefd80373f..c62f9d84554046408d9fae5977695ce4a628ea6e 100644
--- a/ecrire/inc/filtres_images_lib_mini.php
+++ b/ecrire/inc/filtres_images_lib_mini.php
@@ -120,6 +120,7 @@ function _couleur_hex_to_hsl($couleur) {
  * @return array
  */
 function _couleur_rgb_to_hsl($R, $G, $B) {
+	$H = null;
 	$var_R = ($R / 255); // Where RGB values = 0 ÷ 255
 	$var_G = ($G / 255);
 	$var_B = ($B / 255);
@@ -306,6 +307,8 @@ function statut_effacer_images_temporaires($stat) {
  *     - array : tableau décrivant de l'image
  */
 function _image_valeurs_trans($img, $effet, $forcer_format = false, $fonction_creation = null, $find_in_path = false, $support_svg = false) {
+	$ret = [];
+	$f = null;
 	static $images_recalcul = [];
 	if (strlen($img) == 0) {
 		return false;
@@ -388,7 +391,7 @@ function _image_valeurs_trans($img, $effet, $forcer_format = false, $fonction_cr
 	) {
 		// on passe la balise img a taille image qui exraira les attributs si possible
 		// au lieu de faire un acces disque sur le fichier
-		list($ret['hauteur'], $ret['largeur']) = taille_image($find_in_path ? $f : $img);
+		[$ret['hauteur'], $ret['largeur']] = taille_image($find_in_path ? $f : $img);
 		$date_src = @filemtime($f);
 	} elseif (
 		@file_exists($f = "$fichier.src")
@@ -425,8 +428,8 @@ function _image_valeurs_trans($img, $effet, $forcer_format = false, $fonction_cr
 	// un cache par dimension, et le nom de fichier est conserve, suffixe par la dimension aussi
 	$cache = 'cache-gd2';
 	if (substr($effet, 0, 7) == 'reduire') {
-		list(, $maxWidth, $maxHeight) = explode('-', $effet);
-		list($destWidth, $destHeight) = _image_ratio($ret['largeur'], $ret['hauteur'], $maxWidth, $maxHeight);
+		[, $maxWidth, $maxHeight] = explode('-', $effet);
+		[$destWidth, $destHeight] = _image_ratio($ret['largeur'], $ret['hauteur'], $maxWidth, $maxHeight);
 		$ret['largeur_dest'] = $destWidth;
 		$ret['hauteur_dest'] = $destHeight;
 		$effet = "L{$destWidth}xH$destHeight";
@@ -1043,7 +1046,7 @@ function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE, $fonction
 	) {
 		if (@file_exists($valeurs['fichier_dest'])) {
 			// dans tous les cas mettre a jour la taille de l'image finale
-			list($valeurs['hauteur_dest'], $valeurs['largeur_dest']) = taille_image($valeurs['fichier_dest']);
+			[$valeurs['hauteur_dest'], $valeurs['largeur_dest']] = taille_image($valeurs['fichier_dest']);
 			$valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition
 			ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true);
 		}
@@ -1380,6 +1383,8 @@ function _image_ecrire_tag($valeurs, $surcharge = []) {
  *     Description de l'image, sinon null.
  **/
 function _image_creer_vignette($valeurs, $maxWidth, $maxHeight, $process = 'AUTO', $force = false) {
+	$srcHeight = null;
+	$retour = [];
 	// ordre de preference des formats graphiques pour creer les vignettes
 	// le premier format disponible, selon la methode demandee, est utilise
 	$image = $valeurs['fichier'];
@@ -1402,7 +1407,7 @@ function _image_creer_vignette($valeurs, $maxWidth, $maxHeight, $process = 'AUTO
 	// calculer la taille
 	if (($srcWidth = $valeurs['largeur']) && ($srcHeight = $valeurs['hauteur'])) {
 		if (!($destWidth = $valeurs['largeur_dest']) || !($destHeight = $valeurs['hauteur_dest'])) {
-			list($destWidth, $destHeight) = _image_ratio($srcWidth, $srcHeight, $maxWidth, $maxHeight);
+			[$destWidth, $destHeight] = _image_ratio($srcWidth, $srcHeight, $maxWidth, $maxHeight);
 		}
 	} elseif ($process == 'convert' or $process == 'imagick') {
 		$destWidth = $maxWidth;
@@ -1462,7 +1467,7 @@ function _image_creer_vignette($valeurs, $maxWidth, $maxHeight, $process = 'AUTO
 	elseif ($process == 'imagick') {
 		$vignette = "$destination." . $format_sortie;
 
-		if (!class_exists('Imagick')) {
+		if (!class_exists(\Imagick::class)) {
 			spip_log('Classe Imagick absente !', _LOG_ERREUR);
 
 			return;
@@ -1808,7 +1813,7 @@ function process_image_reduire($fonction, $img, $taille, $taille_y, $force, $pro
 			$srcw = extraire_attribut($img, 'width')
 			and $srch = extraire_attribut($img, 'height')
 		) {
-			list($w, $h) = _image_ratio($srcw, $srch, $taille, $taille_y);
+			[$w, $h] = _image_ratio($srcw, $srch, $taille, $taille_y);
 
 			return _image_tag_changer_taille($img, $w, $h);
 		}
diff --git a/ecrire/inc/filtres_images_mini.php b/ecrire/inc/filtres_images_mini.php
index 92e58533ca1e64f6eb9ae1c4f811b2798e322655..95eba2531de30de61bc6a8fb829622719b58f704 100644
--- a/ecrire/inc/filtres_images_mini.php
+++ b/ecrire/inc/filtres_images_mini.php
@@ -310,7 +310,7 @@ function image_select($img, $width_min = 0, $height_min = 0, $width_max = 10000,
 	if (!$img) {
 		return $img;
 	}
-	list($h, $l) = taille_image($img);
+	[$h, $l] = taille_image($img);
 	$select = true;
 	if ($l < $width_min or $l > $width_max or $h < $height_min or $h > $height_max) {
 		$select = false;
@@ -393,7 +393,7 @@ function image_passe_partout(
 	if (!$img) {
 		return '';
 	}
-	list($hauteur, $largeur) = taille_image($img);
+	[$hauteur, $largeur] = taille_image($img);
 	if ($taille_x === -1) {
 		$taille_x = $GLOBALS['meta']['taille_preview'] ?? 150;
 	}
@@ -411,7 +411,7 @@ function image_passe_partout(
 		return '';
 	}
 
-	list($destWidth, $destHeight, $ratio) = ratio_passe_partout($largeur ?? 0, $hauteur ?? 0, $taille_x, $taille_y);
+	[$destWidth, $destHeight, $ratio] = ratio_passe_partout($largeur ?? 0, $hauteur ?? 0, $taille_x, $taille_y);
 	$fonction = ['image_passe_partout', func_get_args()];
 
 	return process_image_reduire($fonction, $img, $destWidth, $destHeight, $force, $process);
@@ -537,7 +537,7 @@ function image_reduire_par($img, $val = 1, $force = false) {
 	$val = (int)$val;
 	$force = (bool)$force;
 
-	list($hauteur, $largeur) = taille_image($img);
+	[$hauteur, $largeur] = taille_image($img);
 
 	$l = round($largeur / $val);
 	$h = round($hauteur / $val);
diff --git a/ecrire/inc/filtres_mime.php b/ecrire/inc/filtres_mime.php
index 6d7ee47950f29de557a2c10f6362c45b35e92922..7a5ac38a1046114a87d424a3b949d282023aeef6 100644
--- a/ecrire/inc/filtres_mime.php
+++ b/ecrire/inc/filtres_mime.php
@@ -136,7 +136,7 @@ function filtre_text_dist($t) {
  **/
 function filtre_text_csv_dist($t) {
 	include_spip('inc/csv');
-	list($entete, $lignes, $caption) = analyse_csv($t);
+	[$entete, $lignes, $caption] = analyse_csv($t);
 	foreach ($lignes as &$l) {
 		$l = join('|', $l);
 	}
@@ -167,7 +167,7 @@ function filtre_text_html_dist($t) {
 		return appliquer_filtre($t, 'text/plain');
 	}
 
-	list(, $h, $t) = $r;
+	[, $h, $t] = $r;
 
 	$style = '';
 	// recuperer les styles internes
diff --git a/ecrire/inc/filtres_mini.php b/ecrire/inc/filtres_mini.php
index abeb4a5e32933a09f833178960539f13f1d871a1..d5825f68e68e3ee3d64bd695cde98671f80555a7 100644
--- a/ecrire/inc/filtres_mini.php
+++ b/ecrire/inc/filtres_mini.php
@@ -35,7 +35,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  * @return string URL nettoyée
  **/
 function resolve_path($url) {
-	list($url, $query) = array_pad(explode('?', $url, 2), 2, null);
+	[$url, $query] = array_pad(explode('?', $url, 2), 2, null);
 	while (
 		preg_match(',/\.?/,', $url, $regs)    # supprime // et /./
 		or preg_match(',/[^/]*/\.\./,S', $url, $regs)  # supprime /toto/../
@@ -69,6 +69,9 @@ function resolve_path($url) {
  **/
 function suivre_lien($url, $lien) {
 
+	$mot = null;
+	$get = null;
+	$hash = null;
 	if (preg_match(',^(mailto|javascript|data|tel|callto|file|ftp):,iS', $lien)) {
 		return $lien;
 	}
diff --git a/ecrire/inc/filtres_selecteur_generique.php b/ecrire/inc/filtres_selecteur_generique.php
index e4d2e932e9cf7e8f691d3cbc1c146ee13fe5e3e7..89a1adcda3faa04110db89cb4c598a76ba00b64b 100644
--- a/ecrire/inc/filtres_selecteur_generique.php
+++ b/ecrire/inc/filtres_selecteur_generique.php
@@ -166,7 +166,7 @@ function picker_identifie_id_rapide($ref, $rubriques_ou_objets = false, $article
 		return json_export(false);
 	}
 	// Sinon on récupère les infos utiles
-	@list($type, , $id, , , , ) = $match;
+	@[$type, , $id, , , , ] = $match;
 
 	// On regarde si le type trouvé fait partie des objets sélectionnables
 	if (!in_array(table_objet($type), $objets)) {
diff --git a/ecrire/inc/flock.php b/ecrire/inc/flock.php
index 524341629eaf20d8be7919d043536961569d7bba..31737eed36aa73c13b064c69aa13b176af31d100 100644
--- a/ecrire/inc/flock.php
+++ b/ecrire/inc/flock.php
@@ -22,7 +22,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 
 if (!defined('_TEST_FILE_EXISTS')) {
 	/** Permettre d'éviter des tests file_exists sur certains hébergeurs */
-	define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', isset($_ENV['HTTP_HOST']) ? $_ENV['HTTP_HOST'] : ''));
+	define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', $_ENV['HTTP_HOST'] ?? ''));
 }
 
 #define('_SPIP_LOCK_MODE',0); // ne pas utiliser de lock (deconseille)
diff --git a/ecrire/inc/genie.php b/ecrire/inc/genie.php
index b7269082b18575a4225a50dba761dd4815dc3287..5b4e18a5a2fc79e132cec5db21051323530dd35b 100644
--- a/ecrire/inc/genie.php
+++ b/ecrire/inc/genie.php
@@ -162,7 +162,7 @@ function genie_queue_watch_dist() {
 	$programmees = array_column($programmees, 'fonction');
 	foreach ($taches as $tache => $periode) {
 		if (!in_array($tache, $programmees)) {
-			queue_genie_replan_job($tache, $periode, time() - round(rand(1, $periode)), 0);
+			queue_genie_replan_job($tache, $periode, time() - round(random_int(1, $periode)), 0);
 		}
 	}
 	$deja_la = false;
diff --git a/ecrire/inc/idna_convert.class.php b/ecrire/inc/idna_convert.class.php
index 5e4e4fd2839c348483b66e576bb2ceafbdc536c8..b3da68bffe22e5369b41094307af6868fed0d245 100644
--- a/ecrire/inc/idna_convert.class.php
+++ b/ecrire/inc/idna_convert.class.php
@@ -51,7 +51,7 @@
  */
 class idna_convert {
 
-    private $version = '0.9.1';
+    private string $version = '0.9.1';
     protected $sub_version = 'main';
 
     // NP See below
@@ -203,7 +203,7 @@ class idna_convert {
                 $this->_error('Only simple domain name parts can be handled in strict mode');
                 return false;
             }
-            list ($email_pref, $input) = explode('@', $input, 2);
+            [$email_pref, $input] = explode('@', $input, 2);
             $arr = explode('.', $input);
             foreach ($arr as $k => $v) {
                 if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) {
@@ -252,7 +252,7 @@ class idna_convert {
                 $arr = explode('.', $input);
                 foreach ($arr as $k => $v) {
                     $conv = $this->_decode($v);
-                    $arr[$k] = ($conv) ? $conv : $v;
+                    $arr[$k] = $conv ?: $v;
                 }
                 $return = join('.', $arr);
             }
@@ -264,7 +264,7 @@ class idna_convert {
         }
         // The output is UTF-8 by default, other output formats need conversion here
         // If one time encoding is given, use this, else the objects property
-        switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
+        switch ($one_time_encoding ?: $this->_api_encoding) {
             case 'utf8':        return $return; // break;
             case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));  // break;
             case 'ucs4_array':  return $this->_utf8_to_ucs4($return); // break;
@@ -282,7 +282,7 @@ class idna_convert {
     {
         // Forcing conversion of input to UCS4 array
         // If one time encoding is given, use this, else the objects property
-        switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) {
+        switch ($one_time_encoding ?: $this->_api_encoding) {
             case 'utf8':
                 $decoded = $this->_utf8_to_ucs4($decoded);
                 break;
@@ -291,7 +291,7 @@ class idna_convert {
             case 'ucs4_array':
                 break;
             default:
-                $this->_error('Unsupported input format: ' . ($one_time_encoding ? $one_time_encoding : $this->_api_encoding));
+                $this->_error('Unsupported input format: ' . ($one_time_encoding ?: $this->_api_encoding));
                 return false;
         }
 
@@ -494,7 +494,7 @@ class idna_convert {
         if (!$decoded || !is_array($decoded)) {
             return false; // NAMEPREP failed
         }
-        $deco_len = count($decoded);
+        $deco_len = is_countable($decoded) ? count($decoded) : 0;
         if (!$deco_len) {
             return false; // Empty array
         }
@@ -725,7 +725,7 @@ class idna_convert {
      */
     protected function _hangul_compose($input)
     {
-        $inp_len = count($input);
+        $inp_len = is_countable($input) ? count($input) : 0;
         if (!$inp_len) {
             return array();
         }
@@ -767,7 +767,7 @@ class idna_convert {
      */
     protected function _get_combining_class($char)
     {
-        return isset(self::$NP['norm_combcls'][$char]) ? self::$NP['norm_combcls'][$char] : 0;
+        return self::$NP['norm_combcls'][$char] ?? 0;
     }
 
     /**
@@ -778,7 +778,7 @@ class idna_convert {
     protected function _apply_cannonical_ordering($input)
     {
         $swap = true;
-        $size = count($input);
+        $size = is_countable($input) ? count($input) : 0;
         while ($swap) {
             $swap = false;
             $last = $this->_get_combining_class(intval($input[0]));
@@ -811,7 +811,7 @@ class idna_convert {
      */
     protected function _combine($input)
     {
-        $inp_len = count($input);
+        $inp_len = is_countable($input) ? count($input) : 0;
         if (0 == $inp_len) {
             return false;
         }
@@ -819,7 +819,7 @@ class idna_convert {
             if ($np_target[0] != $input[0]) {
                 continue;
             }
-            if (count($np_target) != $inp_len) {
+            if ((is_countable($np_target) ? count($np_target) : 0) != $inp_len) {
                 continue;
             }
             $hit = false;
@@ -858,6 +858,8 @@ class idna_convert {
      */
     protected function _utf8_to_ucs4($input)
     {
+        $start_byte = null;
+        $next_byte = null;
         $output = array();
         $out_len = 0;
         $inp_len = self::byteLength($input);
@@ -1043,7 +1045,7 @@ class idna_convert {
 
         $signature = serialize($params);
         if (!isset($instances[$signature])) {
-            $instances[$signature] = idna_convert::getInstance($params);
+            $instances[$signature] = (new idna_convert())->getInstance($params);
         }
         return $instances[$signature];
     }
diff --git a/ecrire/inc/importer_csv.php b/ecrire/inc/importer_csv.php
index 25b4ac3a52afea0d092ddf462c8a3cc9f39026d0..4e78b866bce2e92496cca9a702125c9e52bdf747 100644
--- a/ecrire/inc/importer_csv.php
+++ b/ecrire/inc/importer_csv.php
@@ -146,7 +146,7 @@ function inc_importer_csv_dist($file, $options = []) {
 							$row[$heading][] = $data[$key];
 						}
 					} else {
-						$row[$heading] = (isset($data[$key])) ? $data[$key] : '';
+						$row[$heading] = $data[$key] ?? '';
 					}
 				}
 				$return[] = $row;
diff --git a/ecrire/inc/informer.php b/ecrire/inc/informer.php
index 1040e79b6d802a9a4d75eaa06fe80cd2bba2d791..13f15f04831defd2aebf587e48c51f4e9e1134ce 100644
--- a/ecrire/inc/informer.php
+++ b/ecrire/inc/informer.php
@@ -35,7 +35,7 @@ function inc_informer_dist($id, $col, $exclus, $rac, $type, $do = 'aff') {
 		if ($GLOBALS['meta']['image_process'] != 'non') {
 			$chercher_logo = charger_fonction('chercher_logo', 'inc');
 			if ($res = $chercher_logo($id, 'id_rubrique', 'on')) {
-				list($fid, $dir, $nom, $format) = $res;
+				[$fid, $dir, $nom, $format] = $res;
 				include_spip('inc/filtres_images_mini');
 				$res = image_reduire("<img src='$fid' alt='' />", 100, 48);
 				if ($res) {
diff --git a/ecrire/inc/install.php b/ecrire/inc/install.php
index 9cc532d6a59b3f2afb9c0b3ce0aaac4cc7492961..40cab33a1d9ebc191c64b5b25c173dd0dffa0e3b 100644
--- a/ecrire/inc/install.php
+++ b/ecrire/inc/install.php
@@ -260,6 +260,7 @@ function bouton_suivant($code = '') {
 
 // https://code.spip.net/@info_progression_etape
 function info_progression_etape($en_cours, $phase, $dir, $erreur = false) {
+	$intitule_etat = [];
 	//$en_cours = _request('etape')?_request('etape'):"";
 	$liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
 	$debut = 1;
@@ -371,7 +372,7 @@ function install_select_serveur() {
 				// proposer mysql par defaut si dispo
 				$checked = ($s == 'mysql' ? " checked='checked'" : '');
 				$options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
-					. "<label for='$s'>" . ($titre ? $titre : $s) . '</label></li>';
+					. "<label for='$s'>" . ($titre ?: $s) . '</label></li>';
 			} else {
 				spip_log("$s: portage indisponible");
 			}
diff --git a/ecrire/inc/invalideur.php b/ecrire/inc/invalideur.php
index 8da3320e0e7b5637f42a000ea692de894e2385a3..a01fff648b96410f4bb2a9e90a21c4237c51d8dd 100644
--- a/ecrire/inc/invalideur.php
+++ b/ecrire/inc/invalideur.php
@@ -43,7 +43,7 @@ function taille_du_cache() {
 	# check dirs until we reach > 500 files
 	$t = 0;
 	$n = 0;
-	$time = isset($GLOBALS['meta']['cache_mark']) ? $GLOBALS['meta']['cache_mark'] : 0;
+	$time = $GLOBALS['meta']['cache_mark'] ?? 0;
 	for ($i = 0; $i < 256; $i++) {
 		$dir = _DIR_CACHE . sprintf('%02s', dechex($i));
 		if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
diff --git a/ecrire/inc/json.php b/ecrire/inc/json.php
index 94a1499af2f450128f7fed8053520db5ff24fe3e..b1f269bee6f607a807cc5d1c73faa3b193e91ac2 100644
--- a/ecrire/inc/json.php
+++ b/ecrire/inc/json.php
@@ -77,7 +77,7 @@ if (!function_exists('json_encode')) {
 
 // https://code.spip.net/@json_export
 function json_export($var) {
-	$var = json_encode($var);
+	$var = json_encode($var, JSON_THROW_ON_ERROR);
 
 	// flag indiquant qu'on est en iframe et qu'il faut proteger nos
 	// donnees dans un <textarea> ; attention $_FILES a ete vide par array_pop
diff --git a/ecrire/inc/lang.php b/ecrire/inc/lang.php
index a652ceb382e316cd17b14939774b7f6fc787267f..3a6c20e13415c6847a959c203444777d6b7e932a 100644
--- a/ecrire/inc/lang.php
+++ b/ecrire/inc/lang.php
@@ -57,9 +57,9 @@ function changer_langue($lang, $liste_langues = null) {
 	}
 
 	if (
-		strpos($liste_langues, ",$lang,") !== false
+		strpos($liste_langues, (string) ",$lang,") !== false
 		or ($lang = preg_replace(',_.*,', '', $lang)
-			and strpos($liste_langues, ",$lang,") !== false)
+			and strpos($liste_langues, (string) ",$lang,") !== false)
 	) {
 		$GLOBALS['spip_lang_rtl'] = lang_dir($lang, '', '_rtl');
 		$GLOBALS['spip_lang_right'] = $GLOBALS['spip_lang_rtl'] ? 'left' : 'right';
@@ -123,7 +123,7 @@ function traduire_nom_langue($lang) {
 	include_spip('inc/lang_liste');
 	include_spip('inc/charsets');
 
-	return html2unicode(isset($GLOBALS['codes_langues'][$lang]) ? $GLOBALS['codes_langues'][$lang] : $lang);
+	return html2unicode($GLOBALS['codes_langues'][$lang] ?? $lang);
 }
 
 //
@@ -139,7 +139,7 @@ function traduire_nom_langue($lang) {
 function lang_dir($lang = '', $droitier = 'ltr', $gaucher = 'rtl') {
 	static $lang_rtl = ['ar', 'fa', 'ku', 'prs', 'ps', 'ur', 'he', 'heb', 'hbo', 'yi'];
 
-	return in_array(($lang ? $lang : $GLOBALS['spip_lang']), $lang_rtl) ?
+	return in_array(($lang ?: $GLOBALS['spip_lang']), $lang_rtl) ?
 		$gaucher : $droitier;
 }
 
@@ -151,9 +151,7 @@ function lang_dir($lang = '', $droitier = 'ltr', $gaucher = 'rtl') {
 // https://code.spip.net/@lang_typo
 function lang_typo($lang = '') {
 	if (!$lang) {
-		$lang = isset($GLOBALS['lang_objet'])
-			? $GLOBALS['lang_objet']
-			: $GLOBALS['spip_lang'];
+		$lang = $GLOBALS['lang_objet'] ?? $GLOBALS['spip_lang'];
 	}
 	if (
 		$lang == 'eo'
@@ -228,7 +226,7 @@ function select_langues($nom_select, $change, $options, $label = '') {
 	$id = 'menu_langues' . $cpt++;
 
 	return
-		"<label for='$id'>" . ($label ? $label : _T('info_langues')) . '</label> ' .
+		"<label for='$id'>" . ($label ?: _T('info_langues')) . '</label> ' .
 		"<select name='$nom_select' id='$id' "
 		. ((!test_espace_prive()) ?
 			("class='forml menu_langues'") :
@@ -463,7 +461,7 @@ function init_langues() {
 	if (!isset($GLOBALS['meta']['langue_site'])) {
 		// Initialisation : le francais si dispo, sinon la premiere langue trouvee
 		$GLOBALS['meta']['langue_site'] = $tout =
-			(!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', ",$all_langs,") !== false))
+			(!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', (string) ",$all_langs,") !== false))
 				? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ','));
 		ecrire_meta('langue_site', $tout);
 	}
diff --git a/ecrire/inc/lien.php b/ecrire/inc/lien.php
index 36d2ffae86379f281121b671af00a124d661a1fb..10f62be84031aaea72b135d17611ff9612066aec 100644
--- a/ecrire/inc/lien.php
+++ b/ecrire/inc/lien.php
@@ -97,9 +97,9 @@ function virtuel_redirige($virtuel, $url = false) {
 
 // https://code.spip.net/@calculer_url
 function calculer_url($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) {
-	$r = traiter_lien_implicite($ref, $texte, $pour, $connect, $echappe_typo);
+	$r = traiter_lien_implicite($ref, $texte, $pour, $connect);
 
-	return $r ? $r : traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo);
+	return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo);
 }
 
 define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS');
@@ -158,24 +158,25 @@ function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, string $c
 
 // https://code.spip.net/@traiter_lien_implicite
 function traiter_lien_implicite($ref, $texte = '', $pour = 'url', string $connect = '') {
+	$url = null;
 	if (!($match = typer_raccourci($ref))) {
 		return false;
 	}
-	@list($type, , $id, , $args, , $ancre) = $match;
+	@[$type, , $id, , $args, , $ancre] = $match;
 	// attention dans le cas des sites le lien doit pointer non pas sur
 	// la page locale du site, mais directement sur le site lui-meme
 	if ($f = charger_fonction("implicite_$type", 'liens', true)) {
 		$url = $f($texte, $id, $type, $args, $ancre, $connect);
 	}
 	if (!$url) {
-		$url = generer_url_entite($id, $type, $args, $ancre, $connect ? $connect : null);
+		$url = generer_url_entite($id, $type, $args, $ancre, $connect ?: null);
 	}
 	if (!$url) {
 		return false;
 	}
 	if (is_array($url)) {
-		@list($type, $id) = $url;
-		$url = generer_url_entite($id, $type, $args, $ancre, $connect ? $connect : null);
+		@[$type, $id] = $url;
+		$url = generer_url_entite($id, $type, $args, $ancre, $connect ?: null);
 	}
 	if ($pour === 'url') {
 		return $url;
@@ -326,14 +327,14 @@ function traiter_modeles($texte, $doublons = false, $echap = '', string $connect
 		foreach ($matches as $match) {
 			// Recuperer l'appel complet (y compris un eventuel lien)
 
-			$a = strpos($texte, $match[0]);
+			$a = strpos($texte, (string) $match[0]);
 			preg_match(
 				_RACCOURCI_MODELE_DEBUT,
 				substr($texte, $a),
 				$regs
 			);
 			$regs[] = ''; // s'assurer qu'il y a toujours un 5e arg, eventuellement vide
-			list(, $mod, $type, $id, $params, $fin) = $regs;
+			[, $mod, $type, $id, $params, $fin] = $regs;
 			if (
 				$fin and
 				preg_match(
@@ -408,7 +409,7 @@ function traiter_modeles($texte, $doublons = false, $echap = '', string $connect
 
 			// hack pour tout l'espace prive
 			if (((!_DIR_RESTREINT) or ($doublons)) and ($id)) {
-				foreach ($doublons ? $doublons : ['documents' => ['doc', 'emb', 'img']] as $quoi => $modeles) {
+				foreach ($doublons ?: ['documents' => ['doc', 'emb', 'img']] as $quoi => $modeles) {
 					if (in_array($type, $modeles)) {
 						$GLOBALS["doublons_{$quoi}_inclus"][] = $id;
 					}
diff --git a/ecrire/inc/log.php b/ecrire/inc/log.php
index 66276411b1fe76684b3722065087ff8303f49e8b..4f8b18008bbdaddc864ff15bf7e0393a43772bd8 100644
--- a/ecrire/inc/log.php
+++ b/ecrire/inc/log.php
@@ -37,9 +37,9 @@ function inc_log_dist($message, $logname = null, $logdir = null, $logsuf = null)
 		return;
 	}
 
-	$logfile = ($logdir === null ? _DIR_LOG : $logdir)
+	$logfile = ($logdir ?? _DIR_LOG)
 		. ($logname)
-		. ($logsuf === null ? _FILE_LOG_SUFFIX : $logsuf);
+		. ($logsuf ?? _FILE_LOG_SUFFIX);
 
 	if (!isset($test_repertoire[$d = dirname($logfile)])) {
 		$test_repertoire[$d] = false; // eviter une recursivite en cas d'erreur de sous_repertoire
@@ -71,11 +71,11 @@ function inc_log_dist($message, $logname = null, $logdir = null, $logsuf = null)
 		if (strncmp($fi, _ROOT_RACINE, strlen(_ROOT_RACINE)) == 0) {
 			$fi = substr($fi, strlen(_ROOT_RACINE));
 		}
-		$fu = isset($debug[2]['function']) ? $debug[2]['function'] : '';
+		$fu = $debug[2]['function'] ?? '';
 		$debugverb = "$fi:L$l:$fu" . '():';
 	}
 
-	$m = date('Y-m-d H:i:s') . ' ' . (isset($GLOBALS['ip']) ? $GLOBALS['ip'] : '') . ' ' . $pid . ' '
+	$m = date('Y-m-d H:i:s') . ' ' . ($GLOBALS['ip'] ?? '') . ' ' . $pid . ' '
 		//distinguer les logs prives et publics dans les grep
 		. $debugverb
 		. (test_espace_prive() ? ':Pri:' : ':Pub:')
diff --git a/ecrire/inc/math.php b/ecrire/inc/math.php
index 2f425e959961209c8577eb09b16059661da88de6..3eb9cb30c72368da6a7e874039c601319b66023e 100644
--- a/ecrire/inc/math.php
+++ b/ecrire/inc/math.php
@@ -61,7 +61,7 @@ function produire_image_math($tex) {
 			return implode('', file($fichier));
 		} // TeX
 		else {
-			list(, , , $size) = @spip_getimagesize($fichier);
+			[, , , $size] = @spip_getimagesize($fichier);
 			$alt = "alt=\"$tex\" title=\"$tex\"";
 
 			return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />";
@@ -129,7 +129,7 @@ function traiter_math($letexte, $source = '', $defaire_amp = false) {
 				$expression = str_replace('&amp;', '&', $expression);
 			}
 			$echap = "\n<p class=\"spip\" style=\"text-align: center;\">" . produire_image_math($expression) . "</p>\n";
-			$pos = strpos($texte_milieu, $regs[0]);
+			$pos = strpos($texte_milieu, (string) $regs[0]);
 			$texte_milieu = substr($texte_milieu, 0, $pos)
 				. code_echappement($echap, $source)
 				. substr($texte_milieu, $pos + strlen($regs[0]));
@@ -142,7 +142,7 @@ function traiter_math($letexte, $source = '', $defaire_amp = false) {
 				$expression = str_replace('&amp;', '&', $expression);
 			}
 			$echap = produire_image_math($expression);
-			$pos = strpos($texte_milieu, $regs[0]);
+			$pos = strpos($texte_milieu, (string) $regs[0]);
 			$texte_milieu = substr($texte_milieu, 0, $pos)
 				. code_echappement($echap, $source)
 				. substr($texte_milieu, $pos + strlen($regs[0]));
diff --git a/ecrire/inc/meta.php b/ecrire/inc/meta.php
index b8c49bb6b1c88a7e3186bb69574e4f17b3ba33f2..56bfd965f5218f1a21b663914cc453d4dd93f875 100644
--- a/ecrire/inc/meta.php
+++ b/ecrire/inc/meta.php
@@ -28,6 +28,7 @@ define('_META_CACHE_TIME', 1 << 24);
 
 // https://code.spip.net/@inc_meta_dist
 function inc_meta_dist($table = 'meta') {
+	$new = null;
 	// Lire les meta, en cache si present, valide et lisible
 	// en cas d'install ne pas faire confiance au meta_cache eventuel
 	$cache = cache_meta($table);
@@ -56,7 +57,7 @@ function inc_meta_dist($table = 'meta') {
 	if (
 		(test_espace_prive() || isset($_GET['renouvelle_alea']))
 		and $GLOBALS[$table]
-		and (time() > _RENOUVELLE_ALEA + (isset($GLOBALS['meta']['alea_ephemere_date']) ? $GLOBALS['meta']['alea_ephemere_date'] : 0))
+		and (time() > _RENOUVELLE_ALEA + ($GLOBALS['meta']['alea_ephemere_date'] ?? 0))
 	) {
 		// si on n'a pas l'acces en ecriture sur le cache,
 		// ne pas renouveller l'alea sinon le cache devient faux
@@ -112,7 +113,7 @@ function lire_metas($table = 'meta') {
 		}
 	}
 
-	return isset($GLOBALS[$table]) ? $GLOBALS[$table] : null;
+	return $GLOBALS[$table] ?? null;
 }
 
 
@@ -128,7 +129,7 @@ function lire_metas($table = 'meta') {
 function touch_meta($antidate = false, $table = 'meta') {
 	$file = cache_meta($table);
 	if (!$antidate or !@touch($file, $antidate)) {
-		$r = isset($GLOBALS[$table]) ? $GLOBALS[$table] : [];
+		$r = $GLOBALS[$table] ?? [];
 		if ($table == 'meta') {
 			unset($r['alea_ephemere']);
 			unset($r['alea_ephemere_ancien']);
diff --git a/ecrire/inc/minipres.php b/ecrire/inc/minipres.php
index b323e3ff046eaea08d1d6939f0e3083e36e0c79d..16fa619e2513f179655a21391276285216641728 100644
--- a/ecrire/inc/minipres.php
+++ b/ecrire/inc/minipres.php
@@ -184,8 +184,8 @@ function minipres($titre = '', $corps = '', $options = []) {
 			? _T('avis_espace_interdit')
 			: $titre . '&nbsp;: ' . _T('info_acces_interdit');
 
-		$statut = isset($GLOBALS['visiteur_session']['statut']) ? $GLOBALS['visiteur_session']['statut'] : '';
-		$nom = isset($GLOBALS['visiteur_session']['nom']) ? $GLOBALS['visiteur_session']['nom'] : '';
+		$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
+		$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
 
 		if ($statut != '0minirezo') {
 			$titre = _T('info_acces_interdit');
diff --git a/ecrire/inc/nfslock.php b/ecrire/inc/nfslock.php
index 0d305e17e739c920db292a624630e92013ac091e..e9e37a043137d42363cfbc0c1b8d61e01669491f 100644
--- a/ecrire/inc/nfslock.php
+++ b/ecrire/inc/nfslock.php
@@ -168,7 +168,7 @@ function spip_nfslock($fichier, $max_age = 0) {
 			 * another process and unlink it's newly-
 			 * created file.
 			 */
-			sleep(1 + rand(0, 4));
+			sleep(1 + random_int(0, 4));
 			continue;
 		}
 
@@ -177,7 +177,7 @@ function spip_nfslock($fichier, $max_age = 0) {
 		 */
 
 		$tries++;
-		sleep(1 + rand(0, 4));
+		sleep(1 + random_int(0, 4));
 	}
 
 	/*
@@ -282,7 +282,7 @@ function spip_nfsunlock($fichier, $birth, $max_age = 0, $test = false) {
 			if (!$test) {
 				return false;
 			} //(NFSL_LOST);
-			sleep(1 + (rand(0, 4)));    /* so sleep a bit */
+			sleep(1 + (random_int(0, 4)));    /* so sleep a bit */
 		}
 
 		return true;//(NFSL_OK);			/* success */
diff --git a/ecrire/inc/pipelines_ecrire.php b/ecrire/inc/pipelines_ecrire.php
index 0466711a2376e1bda11db964e182708efe5fd471..0bfa94e1f231b3a80c4be8034e53b268d6368789 100644
--- a/ecrire/inc/pipelines_ecrire.php
+++ b/ecrire/inc/pipelines_ecrire.php
@@ -59,7 +59,7 @@ function f_jQuery_prive($texte) {
 	// inserer avant le premier script externe ou a la fin
 	if (
 		preg_match(',<script[^><]*src=,', $texte, $match)
-		and $p = strpos($texte, $match[0])
+		and $p = strpos($texte, (string) $match[0])
 	) {
 		$texte = substr_replace($texte, $x, $p, 0);
 	} else {
@@ -136,7 +136,7 @@ function f_boite_infos($flux) {
 function f_afficher_blocs_ecrire($flux) {
 	static $o = [];
 	if (is_string($fond = $flux['args']['fond'])) {
-		$exec = isset($flux['args']['contexte']['exec']) ? $flux['args']['contexte']['exec'] : _request('exec');
+		$exec = $flux['args']['contexte']['exec'] ?? _request('exec');
 		if (!isset($o[$exec])) {
 			$o[$exec] = trouver_objet_exec($exec);
 		}
@@ -144,7 +144,7 @@ function f_afficher_blocs_ecrire($flux) {
 		if ($exec == 'infos_perso') {
 			$flux['args']['contexte']['id_auteur'] = $GLOBALS['visiteur_session']['id_auteur'];
 		}
-		$typepage = (isset($flux['args']['contexte']['type-page']) ? $flux['args']['contexte']['type-page'] : $exec);
+		$typepage = ($flux['args']['contexte']['type-page'] ?? $exec);
 		if ($fond == "prive/squelettes/navigation/$typepage") {
 			$flux['data']['texte'] = pipeline(
 				'affiche_gauche',
diff --git a/ecrire/inc/plonger.php b/ecrire/inc/plonger.php
index a56845ffb7de88454f953404fb62b41374c43a4a..11ba46799cac49a819a2d386ccfbe17a61248f4d 100644
--- a/ecrire/inc/plonger.php
+++ b/ecrire/inc/plonger.php
@@ -56,7 +56,7 @@ function inc_plonger_dist($id_rubrique, $idom = '', $list = [], $col = 1, $exclu
 			}
 		}
 	}
-	$next = isset($list[$col]) ? $list[$col] : 0;
+	$next = $list[$col] ?? 0;
 	if ($ordre) {
 		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1));
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
diff --git a/ecrire/inc/plugin.php b/ecrire/inc/plugin.php
index 1845864a366d685bfa1c22f4223585acac2c88c6..cfd675d67843cdbc0566cf9a258a7f681d0de52a 100644
--- a/ecrire/inc/plugin.php
+++ b/ecrire/inc/plugin.php
@@ -53,7 +53,7 @@ function liste_plugin_files($dir_plugins = null) {
 	}
 	if (
 		!isset($plugin_files[$dir_plugins])
-		or count($plugin_files[$dir_plugins]) == 0
+		or (is_countable($plugin_files[$dir_plugins]) ? count($plugin_files[$dir_plugins]) : 0) == 0
 	) {
 		$plugin_files[$dir_plugins] = [];
 		foreach (fast_find_plugin_dirs($dir_plugins) as $plugin) {
@@ -494,7 +494,7 @@ function plugin_trier($infos, $liste_non_classee) {
 			// on ne peut inserer qu'apres eux
 			foreach ($info1['necessite'] as $need) {
 				$nom = strtoupper($need['nom']);
-				$compat = isset($need['compatibilite']) ? $need['compatibilite'] : '';
+				$compat = $need['compatibilite'] ?? '';
 				if (!isset($liste[$nom]) or !plugin_version_compatible($compat, $liste[$nom]['version'])) {
 					$info1 = false;
 					break;
@@ -507,7 +507,7 @@ function plugin_trier($infos, $liste_non_classee) {
 			// sauf si ils sont de toute facon absents de la liste
 			foreach ($info1['utilise'] as $need) {
 				$nom = strtoupper($need['nom']);
-				$compat = isset($need['compatibilite']) ? $need['compatibilite'] : '';
+				$compat = $need['compatibilite'] ?? '';
 				if (isset($toute_la_liste[$nom])) {
 					if (
 						!isset($liste[$nom]) or
@@ -635,7 +635,7 @@ function plugin_necessite($n, $liste, $balise = 'necessite') {
 		$r = plugin_controler_necessite(
 			$liste,
 			$id,
-			isset($need['compatibilite']) ? $need['compatibilite'] : '',
+			$need['compatibilite'] ?? '',
 			$balise
 		);
 		if ($r) {
@@ -703,7 +703,7 @@ function plugin_message_incompatibilite($intervalle, $version, $nom, $balise) {
 		$type = 'php';
 	} elseif (strncmp($nom, 'PHP:', 4) === 0) {
 		$type = 'extension_php';
-		list(,$nom) = explode(':', $nom, 2);
+		[, $nom] = explode(':', $nom, 2);
 	}
 
 	if (preg_match(_EXTRAIRE_INTERVALLE, $intervalle, $regs)) {
@@ -832,7 +832,7 @@ function ecrire_plugin_actifs($plugin, $pipe_recherche = false, $operation = 'ra
 			$plugin = $plugin_valides;
 		}
 	}
-	$actifs_avant = isset($GLOBALS['meta']['plugin']) ? $GLOBALS['meta']['plugin'] : '';
+	$actifs_avant = $GLOBALS['meta']['plugin'] ?? '';
 
 	// si une fonction de gestion de dependances existe, l'appeler ici
 	if ($ajouter_dependances = charger_fonction('ajouter_dependances', 'plugins', true)) {
@@ -844,9 +844,9 @@ function ecrire_plugin_actifs($plugin, $pipe_recherche = false, $operation = 'ra
 	// pour ne pas rater l'ajout ou la suppression d'un fichier fonctions/options/administrations
 	// pourra etre evite quand on ne supportera plus les plugin.xml
 	// en deplacant la detection de ces fichiers dans la compilation ci dessous
-	list($infos, $liste, $invalides) = liste_plugin_valides($plugin, true);
+	[$infos, $liste, $invalides] = liste_plugin_valides($plugin, true);
 	// trouver l'ordre d'activation
-	list($plugin_valides, $ordre, $reste) = plugin_trier($infos, $liste);
+	[$plugin_valides, $ordre, $reste] = plugin_trier($infos, $liste);
 	if ($invalides or $reste) {
 		plugins_erreurs(array_merge($invalides, $reste), $liste, $infos);
 	}
@@ -1191,7 +1191,7 @@ function pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche) {
 					$GLOBALS['spip_pipeline'][$nom] = '';
 					}
 					if ($action) {
-						if (strpos($GLOBALS['spip_pipeline'][$nom], "|$prefix$action") === false) {
+						if (strpos($GLOBALS['spip_pipeline'][$nom], (string) "|$prefix$action") === false) {
 							$GLOBALS['spip_pipeline'][$nom] = preg_replace(
 								',(\|\||$),',
 								"|$prefix$action\\1",
@@ -1206,7 +1206,7 @@ function pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche) {
 					}
 				}
 			}
-			if (isset($info['genie']) and count($info['genie'])) {
+			if (isset($info['genie']) and is_countable($info['genie']) ? count($info['genie']) : 0) {
 				if (!isset($prepend_code['taches_generales_cron'])) {
 					$prepend_code['taches_generales_cron'] = '';
 				}
@@ -1220,7 +1220,7 @@ function pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche) {
 					}
 				}
 			}
-			if (isset($info['style']) and count($info['style'])) {
+			if (isset($info['style']) and is_countable($info['style']) ? count($info['style']) : 0) {
 				if (!isset($prepend_code['insert_head_css'])) {
 					$prepend_code['insert_head_css'] = '';
 				}
@@ -1252,7 +1252,7 @@ function pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche) {
 			if (!isset($prepend_code['header_prive'])) {
 				$prepend_code['header_prive'] = '';
 			}
-			if (isset($info['script']) and count($info['script'])) {
+			if (isset($info['script']) and is_countable($info['script']) ? count($info['script']) : 0) {
 				foreach ($info['script'] as $script) {
 					if (isset($script['path']) and $script['path']) {
 						$code = "if (\$f=timestamp(find_in_path('" . addslashes($script['path']) . "'))) ";
@@ -1415,7 +1415,7 @@ function plugin_installes_meta() {
 					$meta_plug_installes[] = $plug;
 				}
 				if (is_array($infos)) {
-					list($ok, $trace) = $infos['install_test'];
+					[$ok, $trace] = $infos['install_test'];
 					$titre = _T('plugin_titre_installation', ['plugin' => typo($infos['nom'])]);
 					$result = ($ok ? ((isset($infos['upgrade']) && $infos['upgrade']) ? _T('plugin_info_upgrade_ok') : _T('plugin_info_install_ok')) : _T('avis_operation_echec'));
 					if (_IS_CLI) {
diff --git a/ecrire/inc/precharger_objet.php b/ecrire/inc/precharger_objet.php
index 95efc6da46998a47bdefdf1cca8166794043bf7c..f999250304706121ab9cb4d4351608aefba4a881 100644
--- a/ecrire/inc/precharger_objet.php
+++ b/ecrire/inc/precharger_objet.php
@@ -45,6 +45,7 @@ include_spip('inc/autoriser'); // necessaire si appel de l'espace public
  **/
 function precharger_objet($type, $id_objet, $id_rubrique = 0, $lier_trad = 0, $champ_titre = 'titre') {
 
+	$row = [];
 	$table = table_objet_sql($type);
 	$_id_objet = id_table_objet($table);
 
diff --git a/ecrire/inc/prepare_recherche.php b/ecrire/inc/prepare_recherche.php
index 821d08193597bfa8ab6da450900fa8525adec195..069fbec26763a70e08e9f6b9d75eb05a9e9c21cc 100644
--- a/ecrire/inc/prepare_recherche.php
+++ b/ecrire/inc/prepare_recherche.php
@@ -56,10 +56,12 @@ function inc_prepare_recherche_dist(
 	$modificateurs = [],
 	$primary = ''
 ) {
+	$where = null;
+	$rows = null;
 	static $cache = [];
 	$delai_fraicheur = min(
-		_DELAI_CACHE_resultats,
-		time() - (isset($GLOBALS['meta']['derniere_modif']) ? $GLOBALS['meta']['derniere_modif'] : 0)
+		\_DELAI_CACHE_RESULTATS,
+		time() - ($GLOBALS['meta']['derniere_modif'] ?? 0)
 	);
 
 	// si recherche n'est pas dans le contexte, on va prendre en globals
@@ -115,7 +117,7 @@ function inc_prepare_recherche_dist(
 			$serveur
 		);
 		// pas de résultat, pas de point
-		$points = isset($points[$x]) ? $points[$x] : [];
+		$points = $points[$x] ?? [];
 
 		// permettre aux plugins de modifier le resultat
 		$points = pipeline('prepare_recherche', [
@@ -143,7 +145,7 @@ function inc_prepare_recherche_dist(
 		);
 
 		// inserer les resultats dans la table de cache des resultats
-		if (count($points)) {
+		if (is_countable($points) ? count($points) : 0) {
 			$tab_couples = [];
 			foreach ($points as $id => $p) {
 				$tab_couples[] = [
diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php
index 039923c406cab45cc3f88f6d5d6202817503d5c4..fd7bd9f9fe83504b47972e1e7c702c2078b8fdea 100644
--- a/ecrire/inc/presentation.php
+++ b/ecrire/inc/presentation.php
@@ -32,6 +32,7 @@ include_spip('inc/filtres_alertes');
 
 // https://code.spip.net/@debut_cadre
 function debut_cadre($style, $icone = '', $fonction = '', $titre = '', $id = '', $class = '', $padding = true) {
+	$fond = null;
 	$style_mapping = [
 		'r' => 'simple',
 		'e' => 'raccourcis',
@@ -43,7 +44,7 @@ function debut_cadre($style, $icone = '', $fonction = '', $titre = '', $id = '',
 		'sous_rub' => 'simple sous-rub'
 	];
 	$style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section'];
-	$c = isset($style_mapping[$style]) ? $style_mapping[$style] : 'simple';
+	$c = $style_mapping[$style] ?? 'simple';
 	$class = $c . ($class ? " $class" : '');
 	if (!$padding) {
 		$class .= ($class ? ' ' : '') . 'no-padding';
@@ -52,7 +53,7 @@ function debut_cadre($style, $icone = '', $fonction = '', $titre = '', $id = '',
 	//($id?"id='$id' ":"")
 	if (strlen($icone) > 1) {
 		if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) {
-			list($fond, $fonction) = $icone_renommer($icone, $fonction);
+			[$fond, $fonction] = $icone_renommer($icone, $fonction);
 		}
 		$size = 24;
 		if (preg_match('/-([0-9]{1,3})[.](gif|png)$/i', $fond, $match)) {
@@ -69,7 +70,7 @@ function debut_cadre($style, $icone = '', $fonction = '', $titre = '', $id = '',
 		$titre = $icone . $titre;
 	}
 
-	return boite_ouvrir($titre, $class, isset($style_titre_mapping[$style]) ? $style_titre_mapping[$style] : '', $id);
+	return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id);
 }
 
 // https://code.spip.net/@fin_cadre
@@ -90,7 +91,7 @@ function debut_cadre_relief(
 }
 
 function fin_cadre_relief() {
- return fin_cadre('r');
+ return fin_cadre();
 }
 
 function debut_cadre_enfonce(
@@ -105,7 +106,7 @@ function debut_cadre_enfonce(
 }
 
 function fin_cadre_enfonce() {
- return fin_cadre('e');
+ return fin_cadre();
 }
 
 function debut_cadre_sous_rub(
@@ -120,7 +121,7 @@ function debut_cadre_sous_rub(
 }
 
 function fin_cadre_sous_rub() {
- return fin_cadre('sous_rub');
+ return fin_cadre();
 }
 
 function debut_cadre_couleur(
@@ -135,7 +136,7 @@ function debut_cadre_couleur(
 }
 
 function fin_cadre_couleur() {
- return fin_cadre('couleur');
+ return fin_cadre();
 }
 
 function debut_cadre_trait_couleur(
@@ -150,7 +151,7 @@ function debut_cadre_trait_couleur(
 }
 
 function fin_cadre_trait_couleur() {
- return fin_cadre('trait-couleur');
+ return fin_cadre();
 }
 
 function debut_boite_alerte() {
@@ -158,7 +159,7 @@ function debut_boite_alerte() {
 }
 
 function fin_boite_alerte() {
- return fin_cadre('alerte');
+ return fin_cadre();
 }
 
 function debut_boite_info() {
@@ -166,7 +167,7 @@ function debut_boite_info() {
 }
 
 function fin_boite_info() {
- return fin_cadre('info');
+ return fin_cadre();
 }
 
 /**
@@ -247,7 +248,7 @@ function icone_verticale($texte, $lien, $fond, $fonction = '', $align = '', $jav
 	// cas d'ajax_action_auteur: faut defaire le boulot
 	// (il faudrait fusionner avec le cas $javascript)
 	if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) {
-		list($x, $lien, $atts, $texte) = $r;
+		[$x, $lien, $atts, $texte] = $r;
 		$javascript .= $atts;
 	}
 
@@ -280,7 +281,7 @@ function icone_horizontale($texte, $lien, $fond, $fonction = '', $dummy = '', $j
 	// cas d'ajax_action_auteur: faut defaire le boulot
 	// (il faudrait fusionner avec le cas $javascript)
 	if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) {
-		list($x, $lien, $atts, $texte) = $r;
+		[$x, $lien, $atts, $texte] = $r;
 		$javascript .= $atts;
 	}
 
diff --git a/ecrire/inc/presentation_mini.php b/ecrire/inc/presentation_mini.php
index e49e34976c7ad04b95989b8d288189865fb0caf5..b8ccb0839fc409fa532e2fca1804c99ff32dd73e 100644
--- a/ecrire/inc/presentation_mini.php
+++ b/ecrire/inc/presentation_mini.php
@@ -198,7 +198,7 @@ function html_tests_js() {
  **/
 function info_maj_spip() {
 
-	$maj = isset($GLOBALS['meta']['info_maj_spip']) ? $GLOBALS['meta']['info_maj_spip'] : null;
+	$maj = $GLOBALS['meta']['info_maj_spip'] ?? null;
 	if (!$maj) {
 		return '';
 	}
@@ -241,7 +241,7 @@ function info_copyright() {
 			$url = '';
 		}
 		// affichage "GIT [master: abcdef]"
-		$commit = isset($vcs['commit_short']) ? $vcs['commit_short'] : $vcs['commit'];
+		$commit = $vcs['commit_short'] ?? $vcs['commit'];
 		if ($url) {
 			$commit = "<a href=\"$url\" target=\"_blank\" rel=\"noopener noreferrer\">$commit</a>";
 		}
diff --git a/ecrire/inc/presenter_enfants.php b/ecrire/inc/presenter_enfants.php
index 747d5f4798cac2033b8e1ec09f09cd2aa4f65a63..442c4c734a49dc3393e5d71dbd6ad32cdd7d7096 100644
--- a/ecrire/inc/presenter_enfants.php
+++ b/ecrire/inc/presenter_enfants.php
@@ -66,7 +66,7 @@ function enfant_rub($collection, $debut = 0, $limite = 500) {
 
 			if ($voir_logo) {
 				if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) {
-					list($fid, $dir, $nom, $format) = $logo;
+					[$fid, $dir, $nom, $format] = $logo;
 					$logo = image_recadre_avec_fallback("<img src='$fid' alt='' />", 70, 70);
 					if ($logo) {
 						$logo = wrap(inserer_attribut($logo, 'class', 'logo'), '<span class="logo-carre">');
@@ -98,7 +98,7 @@ function enfant_rub($collection, $debut = 0, $limite = 500) {
 			$res[] =
 				debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) .
 				$les_sous_enfants .
-				fin_cadre_sous_rub(true);
+				fin_cadre_sous_rub();
 		}
 	}
 
@@ -128,7 +128,7 @@ function sous_enfant_rub($collection2) {
 	 * Si > 500 on affiche une pagination
 	 */
 	if ($nb > $limite) {
-		$debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut;
+		$debut = _request('debut_rubrique' . $collection2) ?: $debut;
 		$pagination = chercher_filtre('pagination');
 		$pagination = '<p class="pagination">' . $pagination(
 			$nb,
@@ -202,7 +202,7 @@ function afficher_enfant_rub($id_rubrique = 0) {
 	$nb = sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique));
 
 	if ($nb > $limite) {
-		$debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut;
+		$debut = _request('debut_rubrique' . $id_rubrique) ?: $debut;
 		$pagination = chercher_filtre('pagination');
 		$pagination = '<br class="nettoyeur"><p class="pagination">' .
 			$pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') .
diff --git a/ecrire/inc/puce_statut.php b/ecrire/inc/puce_statut.php
index 3c92726353aa3e847755b02cf2314649f87de334..3a34b74ed2cce3b707d71a05205c9e0b2255b171 100644
--- a/ecrire/inc/puce_statut.php
+++ b/ecrire/inc/puce_statut.php
@@ -388,7 +388,7 @@ function puce_statut_changement_rapide(
 	$clip = $zero + ($unit * $coord[$statut]);
 
 	if ($ajax) {
-		$width = $unit * count($desc['statut_textes_instituer']) + $margin;
+		$width = $unit * (is_countable($desc['statut_textes_instituer']) ? count($desc['statut_textes_instituer']) : 0) + $margin;
 		$out = "<span class='puce_objet_fixe $type'>"
 			. $inser_puce
 			. '</span>'
diff --git a/ecrire/inc/queue.php b/ecrire/inc/queue.php
index 9e79a918e578eb54a2d92aa608ab210c7d8eba1e..243639995b6cd9a244a7c020ddd23a65697ce5b4 100644
--- a/ecrire/inc/queue.php
+++ b/ecrire/inc/queue.php
@@ -263,7 +263,7 @@ function queue_start_job($row) {
 	}
 
 	spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue');
-	switch (count($args)) {
+	switch (is_countable($args) ? count($args) : 0) {
 		case 0:
 			$res = $fonction();
 			break;
@@ -694,7 +694,7 @@ function queue_lancer_url_http_async($url_cron) {
 		}
 		$fp = @fsockopen(
 			$scheme . $parts['host'],
-			isset($parts['port']) ? $parts['port'] : $port,
+			$parts['port'] ?? $port,
 			$errno,
 			$errstr,
 			1
diff --git a/ecrire/inc/recherche_to_array.php b/ecrire/inc/recherche_to_array.php
index 21839491e91b1c966c408a6083e19f477ed6bac4..7d9ce59b9e58a48de07de8101258ef266bc3e0ae 100644
--- a/ecrire/inc/recherche_to_array.php
+++ b/ecrire/inc/recherche_to_array.php
@@ -52,7 +52,7 @@ function inc_recherche_to_array_dist($recherche, $options = []) {
 	}
 	$serveur = $options['serveur'];
 
-	list($methode, $q, $preg) = expression_recherche($recherche, $options);
+	[$methode, $q, $preg] = expression_recherche($recherche, $options);
 
 	$jointures = $options['jointures']
 		? liste_des_jointures()
@@ -226,7 +226,7 @@ function inc_recherche_to_array_dist($recherche, $options = []) {
 				// sinon cherchons une table de liaison
 				// cas recherche principale article, objet lie document : passer par spip_documents_liens
 				elseif ($l = objet_associable($table_liee)) {
-					list($primary, $table_liens) = $l;
+					[$primary, $table_liens] = $l;
 					$s = sql_select(
 						"id_objet as $cle_depart, $primary as $cle_arrivee",
 						$table_liens,
@@ -239,7 +239,7 @@ function inc_recherche_to_array_dist($recherche, $options = []) {
 					);
 				} // cas recherche principale auteur, objet lie article: passer par spip_auteurs_liens
 				elseif ($l = $depart_associable) {
-					list($primary, $table_liens) = $l;
+					[$primary, $table_liens] = $l;
 					$s = sql_select(
 						"$primary as $cle_depart, id_objet as $cle_arrivee",
 						$table_liens,
@@ -267,7 +267,7 @@ function inc_recherche_to_array_dist($recherche, $options = []) {
 					);
 				}
 			} else {
-				list($cle_depart, $cle_arrivee, $s) = $rechercher_joints(
+				[$cle_depart, $cle_arrivee, $s] = $rechercher_joints(
 					$table,
 					$table_liee,
 					array_keys($ids_trouves),
diff --git a/ecrire/inc/rechercher.php b/ecrire/inc/rechercher.php
index 3c4aa3afbc5364d0b7587592ea05d19794b32ce2..ddb81e725e8f9a9b7e4e5d3a962e92cf86e80859 100644
--- a/ecrire/inc/rechercher.php
+++ b/ecrire/inc/rechercher.php
@@ -86,7 +86,7 @@ function expression_recherche($recherche, $options) {
 	}
 
 	$u = $GLOBALS['meta']['pcre_u'];
-	if ($u and strpos($options['preg_flags'], $u) === false) {
+	if ($u and strpos($options['preg_flags'], (string) $u) === false) {
 		$options['preg_flags'] .= $u;
 	}
 	include_spip('inc/charsets');
@@ -217,8 +217,8 @@ function expression_recherche($recherche, $options) {
 	// les plus frequents qui peuvent etre accentues
 	// (oui c'est tres dicustable...)
 	if (
-		isset($GLOBALS['connexions'][$options['serveur'] ? $options['serveur'] : 0]['type'])
-		and strncmp($GLOBALS['connexions'][$options['serveur'] ? $options['serveur'] : 0]['type'], 'sqlite', 6) == 0
+		isset($GLOBALS['connexions'][$options['serveur'] ?: 0]['type'])
+		and strncmp($GLOBALS['connexions'][$options['serveur'] ?: 0]['type'], 'sqlite', 6) == 0
 	) {
 		$q_t = strtr($q, 'aeuioc', $is_preg ? '......' : '______');
 		// si il reste au moins un char significatif...
@@ -326,7 +326,7 @@ function recherche_en_base($recherche = '', $tables = null, $options = [], $serv
 
 
 		spip_log(
-			"recherche $table ($recherche) : " . count($results[$table]) . ' resultats ' . spip_timer('rech'),
+			"recherche $table ($recherche) : " . (is_countable($results[$table]) ? count($results[$table]) : 0) . ' resultats ' . spip_timer('rech'),
 			'recherche'
 		);
 
diff --git a/ecrire/inc/roles.php b/ecrire/inc/roles.php
index 3a15e83d28d08ac35d9ce13e35e15da6959aebf5..468a5a81ce7b5c748b20bc0af943cca14ce43cd7 100644
--- a/ecrire/inc/roles.php
+++ b/ecrire/inc/roles.php
@@ -62,9 +62,9 @@ function roles_presents($objet, $objet_destination = '') {
 	}
 
 	// on cherche ensuite si la colonne existe bien dans la table de liaison (par défaut 'role')
-	$colonne = isset($desc['roles_colonne']) ? $desc['roles_colonne'] : 'role';
+	$colonne = $desc['roles_colonne'] ?? 'role';
 	$trouver_table = charger_fonction('trouver_table', 'base');
-	list(, $table_lien) = $lien;
+	[, $table_lien] = $lien;
 	$desc_lien = $trouver_table($table_lien);
 	if (!isset($desc_lien['field'][$colonne])) {
 		return false;
@@ -176,10 +176,10 @@ function roles_trouver_dans_qualif($objet, $objet_destination, $qualif = []) {
  **/
 function roles_creer_condition_role($objet_source, $objet, $cond, $tous_si_absent = false) {
 	// role par défaut, colonne
-	list($role_defaut, $colonne_role) = roles_trouver_dans_qualif($objet_source, $objet);
+	[$role_defaut, $colonne_role] = roles_trouver_dans_qualif($objet_source, $objet);
 
 	// chercher d'eventuels rôles transmis
-	$role = (isset($cond['role']) ? $cond['role'] : ($tous_si_absent ? '*' : $role_defaut));
+	$role = ($cond['role'] ?? ($tous_si_absent ? '*' : $role_defaut));
 	unset($cond['role']); // cette condition est particuliere...
 
 	if ($colonne_role) {
@@ -363,7 +363,7 @@ function roles_connus_en_base($objet_source, $objet, $objet_lien) {
 		return $done[$hash] = false;
 	}
 
-	list($primary, $l) = $lien;
+	[$primary, $l] = $lien;
 	$colone_role = $roles['colonne'];
 
 	$all = sql_allfetsel(
diff --git a/ecrire/inc/rubriques.php b/ecrire/inc/rubriques.php
index a6896c225ce0d12f270b7186ad635f43b5c98e48..93e193f9e605bff0166eaea84684682ebec2379d 100644
--- a/ecrire/inc/rubriques.php
+++ b/ecrire/inc/rubriques.php
@@ -54,6 +54,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *     true si le statut change effectivement
  **/
 function calculer_rubriques_if($id_rubrique, $modifs, $infos = [], $postdate = false) {
+	$statuts_publies = null;
 	$neuf = false;
 
 	// Compat avec l'ancienne signature
@@ -629,7 +630,7 @@ function calculer_langues_utilisees($serveur = '') {
 				];
 				// generer un nom de fonction "anonyme" unique
 				do {
-					$functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . rand();
+					$functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . random_int(0, mt_getrandmax());
 				} while (function_exists($functionname));
 				$code = calculer_boucle('calculer_langues_utilisees', $boucles);
 				$code = '$SP=0; $command=array();$command["connect"] = $connect = "' . $serveur . '"; $Pile=array(0=>array());' . "\n" . $code;
diff --git a/ecrire/inc/securiser_action.php b/ecrire/inc/securiser_action.php
index 7fad7047e56cf8a8ef291aa293edad53dfe9d90c..edcadc231a9793006fe1d82fa2b001e4b553a292 100644
--- a/ecrire/inc/securiser_action.php
+++ b/ecrire/inc/securiser_action.php
@@ -55,7 +55,7 @@ function inc_securiser_action_dist($action = '', $arg = '', $redirect = '', $mod
 	} else {
 		$arg = _request('arg');
 		$hash = _request('hash');
-		$action = _request('action') ? _request('action') : _request('formulaire_action');
+		$action = _request('action') ?: _request('formulaire_action');
 		if ($a = verifier_action_auteur("$action-$arg", $hash)) {
 			return $arg;
 		}
@@ -191,7 +191,7 @@ function caracteriser_auteur($id_auteur = null) {
 	}
 	// Eviter l'acces SQL si le pass est connu de PHP
 	if (is_null($id_auteur)) {
-		$id_auteur = isset($GLOBALS['visiteur_session']['id_auteur']) ? $GLOBALS['visiteur_session']['id_auteur'] : 0;
+		$id_auteur = $GLOBALS['visiteur_session']['id_auteur'] ?? 0;
 		if (isset($GLOBALS['visiteur_session']['pass']) and $GLOBALS['visiteur_session']['pass']) {
 			return $caracterisation[$id_auteur] = [$id_auteur, $GLOBALS['visiteur_session']['pass']];
 		}
@@ -260,7 +260,7 @@ function _action_auteur($action, $id_auteur, $pass, $alea) {
  * @return string
  */
 function calculer_action_auteur($action, $id_auteur = null) {
-	list($id_auteur, $pass) = caracteriser_auteur($id_auteur);
+	[$id_auteur, $pass] = caracteriser_auteur($id_auteur);
 
 	return _action_auteur($action, $id_auteur, $pass, 'alea_ephemere');
 }
@@ -275,7 +275,7 @@ function calculer_action_auteur($action, $id_auteur = null) {
  * @return bool
  */
 function verifier_action_auteur($action, $hash) {
-	list($id_auteur, $pass) = caracteriser_auteur();
+	[$id_auteur, $pass] = caracteriser_auteur();
 	if ($hash == _action_auteur($action, $id_auteur, $pass, 'alea_ephemere')) {
 		return true;
 	}
@@ -313,7 +313,7 @@ function secret_du_site() {
 			'secret_du_site',
 			spip_sha256(
 				$_SERVER['DOCUMENT_ROOT']
-				. (isset($_SERVER['SERVER_SIGNATURE']) ? $_SERVER['SERVER_SIGNATURE'] : '')
+				. ($_SERVER['SERVER_SIGNATURE'] ?? '')
 				. creer_uniqid()
 			),
 			'non'
diff --git a/ecrire/inc/session.php b/ecrire/inc/session.php
index 47f4f7773bd8ccd42b40352384d22cb276e2bbb2..853b5015279f6ce369fe5cc3a164758ec34a5503 100644
--- a/ecrire/inc/session.php
+++ b/ecrire/inc/session.php
@@ -173,7 +173,7 @@ function ajouter_session($auteur) {
 		!isset($_COOKIE['spip_session'])
 		or !preg_match(',^' . $id_auteur . '_,', $_COOKIE['spip_session'])
 	) {
-		$_COOKIE['spip_session'] = $id_auteur . '_' . md5(uniqid(rand(), true));
+		$_COOKIE['spip_session'] = $id_auteur . '_' . md5(uniqid(random_int(0, mt_getrandmax()), true));
 	}
 
 	// Maintenant on sait qu'on a des choses à écrire
@@ -389,7 +389,7 @@ function verifier_session($change = false) {
  *     Valeur, si trouvée, `null` sinon.
  */
 function session_get($nom) {
-	return isset($GLOBALS['visiteur_session'][$nom]) ? $GLOBALS['visiteur_session'][$nom] : null;
+	return $GLOBALS['visiteur_session'][$nom] ?? null;
 }
 
 
@@ -716,7 +716,7 @@ function hash_env() {
 		return $res;
 	}
 
-	return $res = md5($GLOBALS['ip'] . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''));
+	return $res = md5($GLOBALS['ip'] . ($_SERVER['HTTP_USER_AGENT'] ?? ''));
 }
 
 
diff --git a/ecrire/inc/simplexml_to_array.php b/ecrire/inc/simplexml_to_array.php
index 0abbdcfd545b9eb2d0d87d8417b97e57b22804f2..76fed542cb6b9451dcd59716a1c5ec8f4f7db22c 100644
--- a/ecrire/inc/simplexml_to_array.php
+++ b/ecrire/inc/simplexml_to_array.php
@@ -43,6 +43,7 @@ function inc_simplexml_to_array_dist($u, $utiliser_namespace = false) {
  **/
 function xmlObjToArr($obj, $utiliser_namespace = false) {
 
+	$namespace = [];
 	$tableau = [];
 
 	// Cette fonction getDocNamespaces() est longue sur de gros xml. On permet donc
diff --git a/ecrire/inc/surligne.php b/ecrire/inc/surligne.php
index c900f17d6912d8755bfd4f9b51df1a8c01db07dc..1e79bfa251bc9707847736e46df059692e379896 100644
--- a/ecrire/inc/surligne.php
+++ b/ecrire/inc/surligne.php
@@ -54,7 +54,7 @@ function surligner_mots($page, $surcharge_surligne = '') {
 	];
 
 
-	$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
+	$ref = $_SERVER['HTTP_REFERER'] ?? null;
 	//avoid a js injection
 	if ($surcharge_surligne) {
 		$surcharge_surligne = preg_replace(",(?<!\\\\)((?:(?>\\\\){2})*)('),", '$1\\\$2', $surcharge_surligne);
diff --git a/ecrire/inc/svg.php b/ecrire/inc/svg.php
index 69ba52b97722357b3bf3ea161436b97681726b81..74e0100c46012830cb9ed7a96c30312e7f7eb555 100644
--- a/ecrire/inc/svg.php
+++ b/ecrire/inc/svg.php
@@ -112,7 +112,7 @@ function svg_lire_balise_svg($fichier) {
 function svg_lire_attributs($img) {
 
 	if ($svg_infos = svg_lire_balise_svg($img)) {
-		list($balise_svg, $attributs) = $svg_infos;
+		[$balise_svg, $attributs] = $svg_infos;
 		return $attributs;
 	}
 
@@ -230,7 +230,7 @@ function svg_redimensionner($img, $new_width, $new_height) {
 		$svg = svg_charger($img)
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
-		list($balise_svg, $attributs) = $svg_infos;
+		[$balise_svg, $attributs] = $svg_infos;
 		if (!isset($attributs['viewBox'])) {
 			$attributs['viewBox'] = '0 0 ' . $attributs['width'] . ' ' . $attributs['height'];
 		}
@@ -364,9 +364,9 @@ function svg_force_viewBox_px($img, $force_width_and_height = false) {
 		$svg = svg_charger($img)
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
-		list($balise_svg, $attributs) = $svg_infos;
+		[$balise_svg, $attributs] = $svg_infos;
 
-		list($width, $height, $viewBox) = svg_getimagesize_from_attr($attributs);
+		[$width, $height, $viewBox] = svg_getimagesize_from_attr($attributs);
 
 		if ($force_width_and_height) {
 			$attributs['width'] = $width;
@@ -407,7 +407,7 @@ function svg_recadrer($img, $new_width, $new_height, $offset_width, $offset_heig
 		$svg = svg_force_viewBox_px($img)
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
-		list($balise_svg, $attributs) = $svg_infos;
+		[$balise_svg, $attributs] = $svg_infos;
 		$viewBox = explode(' ', $attributs['viewBox']);
 
 		$viewport_w = $new_width;
@@ -469,7 +469,7 @@ function svg_ajouter_background($img, $background_color) {
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
 		if ($background_color and $background_color !== 'transparent') {
-			list($balise_svg, $attributs) = $svg_infos;
+			[$balise_svg, $attributs] = $svg_infos;
 
 			$background_color = svg_couleur_to_hexa($background_color);
 			if (isset($attributs['viewBox'])) {
@@ -499,7 +499,7 @@ function svg_ajouter_voile($img, $background_color, $opacity) {
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
 		if ($background_color and $background_color !== 'transparent') {
-			list($balise_svg, $attributs) = $svg_infos;
+			[$balise_svg, $attributs] = $svg_infos;
 
 			$background_color = svg_couleur_to_hexa($background_color);
 			if (isset($attributs['viewBox'])) {
@@ -529,7 +529,7 @@ function svg_transformer($img, $attributs) {
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
 		if ($attributs) {
-			list($balise_svg, ) = $svg_infos;
+			[$balise_svg, ] = $svg_infos;
 			$g = '<g';
 			foreach ($attributs as $k => $v) {
 				if (strlen($v)) {
@@ -560,7 +560,7 @@ function svg_apply_filter($img, $filter_def) {
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
 		if ($filter_def) {
-			list($balise_svg, ) = $svg_infos;
+			[$balise_svg, ] = $svg_infos;
 			$filter_id = 'filter-' . substr(md5($filter_def . strlen($svg)), 0, 8);
 			$filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>";
 			$g = "<g filter=\"url(#$filter_id)\">";
@@ -618,7 +618,7 @@ function svg_flip($img, $HorV) {
 		$svg = svg_force_viewBox_px($img)
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
-		list($balise_svg, $atts) = $svg_infos;
+		[$balise_svg, $atts] = $svg_infos;
 		$viewBox = explode(' ', $atts['viewBox']);
 
 		if (!in_array($HorV, ['h', 'H'])) {
@@ -656,7 +656,7 @@ function svg_rotate($img, $angle, $center_x, $center_y) {
 		$svg = svg_force_viewBox_px($img)
 		and $svg_infos = svg_lire_balise_svg($svg)
 	) {
-		list($balise_svg, $atts) = $svg_infos;
+		[$balise_svg, $atts] = $svg_infos;
 		$viewBox = explode(' ', $atts['viewBox']);
 
 		$center_x = round($viewBox[0] + $center_x * $viewBox[2]);
@@ -695,7 +695,7 @@ function svg_filtrer_couleurs($img, $callback_filter) {
 			}
 		}
 
-		$colors = array_merge($long, $short);
+		$colors = [...$long, ...$short];
 		$new_colors = [];
 		$colors = array_flip($colors);
 		foreach ($colors as $c => $k) {
diff --git a/ecrire/inc/texte.php b/ecrire/inc/texte.php
index df7957a0d263c309e085e28499b90a7bbcf28f85..6a6a5182c273d8eab85c28e1c981ef9483d5f87c 100644
--- a/ecrire/inc/texte.php
+++ b/ecrire/inc/texte.php
@@ -104,7 +104,7 @@ function traiter_raccourcis($letexte) {
 function echappe_js($t, $class = ' class = "echappe-js"') {
 	foreach (['script', 'iframe'] as $tag) {
 		if (
-			stripos($t, "<$tag") !== false
+			stripos($t, (string) "<$tag") !== false
 			and preg_match_all(',<' . $tag . '.*?($|</' . $tag . '.),isS', $t, $r, PREG_SET_ORDER)
 		) {
 			foreach ($r as $regs) {
diff --git a/ecrire/inc/texte_mini.php b/ecrire/inc/texte_mini.php
index a6fb738f66d79b0a23bd23eb6b7a2b25e6540663..98ee4b4d6d28d996cd05c71c674ab8d797d8d2cb 100644
--- a/ecrire/inc/texte_mini.php
+++ b/ecrire/inc/texte_mini.php
@@ -133,7 +133,7 @@ function traiter_echap_pre_dist($regs) {
 // Echapper les <code>...</ code>
 // https://code.spip.net/@traiter_echap_code_dist
 function traiter_echap_code_dist($regs) {
-	list(, , $att, $corps) = $regs;
+	[, , $att, $corps] = $regs;
 	$echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code !
 
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
@@ -228,7 +228,7 @@ function echappe_html(
 
 	if (
 		($preg or strpos($letexte, '<') !== false)
-		and preg_match_all($preg ? $preg : _PROTEGE_BLOCS, $letexte, $matches, PREG_SET_ORDER)
+		and preg_match_all($preg ?: _PROTEGE_BLOCS, $letexte, $matches, PREG_SET_ORDER)
 	) {
 		foreach ($matches as $regs) {
 			// echappements tels quels ?
@@ -244,7 +244,7 @@ function echappe_html(
 				}
 			}
 
-			$p = strpos($letexte, $regs[0]);
+			$p = strpos($letexte, (string) $regs[0]);
 			$letexte = substr_replace($letexte, code_echappement($echap, $source, $no_transform), $p, strlen($regs[0]));
 		}
 	}
@@ -257,7 +257,7 @@ function echappe_html(
 	// seulement si on a echappe les <script>
 	// (derogatoire car on ne peut pas faire passer < ? ... ? >
 	// dans une callback autonommee
-	if (strpos($preg ? $preg : _PROTEGE_BLOCS, 'script') !== false) {
+	if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) {
 		if (
 			strpos($letexte, '<' . '?') !== false and preg_match_all(
 				',<[?].*($|[?]>),UisS',
@@ -285,7 +285,7 @@ function echappe_html(
 // par propre() : exemple dans multi et dans typo()
 // https://code.spip.net/@echappe_retour
 function echappe_retour($letexte, $source = '', $filtre = '') {
-	if (strpos($letexte, "base64$source")) {
+	if (strpos($letexte, (string) "base64$source")) {
 		# spip_log(spip_htmlspecialchars($letexte));  ## pour les curieux
 		$max_prof = 5;
 		while (
@@ -482,7 +482,7 @@ function echapper_faux_tags($letexte) {
 	$textMatches = preg_split(',(</?[a-z!][^<>]*>),', $letexte, -1, PREG_SPLIT_DELIM_CAPTURE);
 
 	$letexte = '';
-	while (count($textMatches)) {
+	while (is_countable($textMatches) ? count($textMatches) : 0) {
 		// un texte a echapper
 		$letexte .= str_replace('<', '&lt;', array_shift($textMatches));
 		// un tag html qui a servit a faite le split
diff --git a/ecrire/inc/traduire.php b/ecrire/inc/traduire.php
index 54db289b941d8e92bd58f8b218addf275a909eac..3c10cd52b7c475e9bd2669f5326cf76b8f40e7d0 100644
--- a/ecrire/inc/traduire.php
+++ b/ecrire/inc/traduire.php
@@ -244,7 +244,7 @@ function inc_traduire_dist($ori, $lang, $raw = false) {
 
 	// modules demandes explicitement <xxx|yyy|zzz:code> cf MODULES_IDIOMES
 	if (strpos($ori, ':')) {
-		list($modules, $code) = explode(':', $ori, 2);
+		[$modules, $code] = explode(':', $ori, 2);
 		$modules = explode('|', $modules);
 		$ori_complet = $ori;
 	} else {
diff --git a/ecrire/inc/urls.php b/ecrire/inc/urls.php
index a487b08408eeb2ee381ff7575def9241f6c58b8c..03695e3f055909b682442cf9ea7037f8247461ea 100644
--- a/ecrire/inc/urls.php
+++ b/ecrire/inc/urls.php
@@ -62,17 +62,17 @@ function urls_decoder_url($url, $fond = '', $contexte = [], $assembler = false)
 	// les anciennes fonctions modifient directement les globales
 	// on les sauve avant l'appel, et on les retablit apres !
 	$save = [
-		isset($GLOBALS['fond']) ? $GLOBALS['fond'] : null,
-		isset($GLOBALS['contexte']) ? $GLOBALS['contexte'] : null,
-		isset($_SERVER['REDIRECT_url_propre']) ? $_SERVER['REDIRECT_url_propre'] : null,
-		isset($_ENV['url_propre']) ? $_ENV['url_propre'] : null,
+		$GLOBALS['fond'] ?? null,
+		$GLOBALS['contexte'] ?? null,
+		$_SERVER['REDIRECT_url_propre'] ?? null,
+		$_ENV['url_propre'] ?? null,
 		$GLOBALS['profondeur_url']
 	];
 
 	if (is_null($current_base)) {
 		include_spip('inc/filtres_mini');
 		// le decodage des urls se fait toujours par rapport au site public
-		$current_base = url_absolue(_DIR_RACINE ? _DIR_RACINE : './');
+		$current_base = url_absolue(_DIR_RACINE ?: './');
 	}
 	if (strncmp($url, $current_base, strlen($current_base)) == 0) {
 		$url = substr($url, strlen($current_base));
@@ -116,7 +116,7 @@ function urls_decoder_url($url, $fond = '', $contexte = [], $assembler = false)
 	if ($renommer) {
 		$a = $renommer($url, $fond, $contexte);
 		if (is_array($a)) {
-			list($ncontexte, $type, $url_redirect, $nfond) = array_pad($a, 4, null);
+			[$ncontexte, $type, $url_redirect, $nfond] = array_pad($a, 4, null);
 			$url_redirect ??= '';
 			if ($url_redirect === $url) {
 				$url_redirect = '';
@@ -156,7 +156,7 @@ function urls_decoder_url($url, $fond = '', $contexte = [], $assembler = false)
 	}
 
 	// retablir les globales
-	list($GLOBALS['fond'], $GLOBALS['contexte'], $_SERVER['REDIRECT_url_propre'], $_ENV['url_propre'], $GLOBALS['profondeur_url']) = $save;
+	[$GLOBALS['fond'], $GLOBALS['contexte'], $_SERVER['REDIRECT_url_propre'], $_ENV['url_propre'], $GLOBALS['profondeur_url']] = $save;
 
 	// vider les globales url propres qui ne doivent plus etre utilisees en cas
 	// d'inversion url => objet
diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index ebbd6a1412235b0ce0a029ecf4da531801be18fb..db667b8c50421580b3b389fe14323d3535e4c4f3 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -123,7 +123,7 @@ function include_once_check($file) {
 		return true;
 	}
 	$crash = (isset($GLOBALS['meta']['message_crash_plugins']) ? unserialize($GLOBALS['meta']['message_crash_plugins']) : '');
-	$crash = ($crash ? $crash : []);
+	$crash = ($crash ?: []);
 	$crash[$file] = true;
 	ecrire_meta('message_crash_plugins', serialize($crash));
 
@@ -419,7 +419,7 @@ function journal($phrase, $opt = []) {
 function _request($var, $c = false) {
 
 	if (is_array($c)) {
-		return isset($c[$var]) ? $c[$var] : null;
+		return $c[$var] ?? null;
 	}
 
 	if (isset($_GET[$var])) {
@@ -927,7 +927,7 @@ function _L($text, $args = [], $options = []) {
 			include_spip('inc/texte_mini');
 		}
 		foreach ($args as $name => $value) {
-			if (strpos($text, "@$name@") !== false) {
+			if (strpos($text, (string) "@$name@") !== false) {
 				if ($options['sanitize']) {
 					$value = echapper_html_suspect($value);
 					$value = interdire_scripts($value, -1);
@@ -1530,7 +1530,7 @@ function chemin_image($icone) {
 		$icone_renommer = charger_fonction('icone_renommer', 'inc', true);
 	}
 	if ($icone_renommer) {
-		list($icone, $fonction) = $icone_renommer($icone, '');
+		[$icone, $fonction] = $icone_renommer($icone, '');
 		if (file_exists($icone)) {
 			return $icone;
 		}
@@ -1804,10 +1804,7 @@ function generer_url_entite($id = '', $entite = '', $args = '', $ancre = '', $pu
 		$res = generer_url_ecrire_objet($entite, $id, $args, $ancre, false);
 	} else {
 		if ($type === null) {
-			$type = (isset($GLOBALS['type_urls']))
-				? $GLOBALS['type_urls'] // pour surcharge via fichier d'options
-				: ((isset($GLOBALS['meta']['type_urls'])) // sinon la config url_etendues
-					? ($GLOBALS['meta']['type_urls']) : 'page'); // sinon type "page" par défaut
+			$type = $GLOBALS['type_urls'] ?? $GLOBALS['meta']['type_urls'] ?? 'page'; // sinon type "page" par défaut
 		}
 
 		$f = charger_fonction($type, 'urls', true);
@@ -1996,7 +1993,7 @@ function url_de_base($profondeur = null) {
 	}
 
 	// note : HTTP_HOST contient le :port si necessaire
-	$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
+	$host = $_SERVER['HTTP_HOST'] ?? null;
 	// si on n'a pas trouvé d'hôte du tout, en dernier recours on utilise adresse_site comme fallback
 	if (is_null($host) and isset($GLOBALS['meta']['adresse_site'])) {
 		$host = $GLOBALS['meta']['adresse_site'];
@@ -2057,7 +2054,7 @@ function url_de_($http, $host, $request, $prof = 0) {
 
 	$myself = ltrim($request, '/');
 	# supprimer la chaine de GET
-	list($myself) = explode('?', $myself);
+	[$myself] = explode('?', $myself);
 	// vieux mode HTTP qui envoie après le nom de la methode l'URL compléte
 	// protocole, "://", nom du serveur avant le path dans _SERVER["REQUEST_URI"]
 	if (strpos($myself, '://') !== false) {
@@ -2111,12 +2108,11 @@ function generer_url_ecrire($script = '', $args = '', $no_entities = false, $rel
 		$rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT;
 	} else {
 		if (!is_string($rel)) {
-			$rel = _DIR_RESTREINT ? _DIR_RESTREINT :
-				('./' . _SPIP_ECRIRE_SCRIPT);
+			$rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT;
 		}
 	}
 
-	list($script, $ancre) = array_pad(explode('#', $script), 2, null);
+	[$script, $ancre] = array_pad(explode('#', $script), 2, null);
 	if ($script and ($script <> 'accueil' or $rel)) {
 		$args = "?exec=$script" . (!$args ? '' : "&$args");
 	} elseif ($args) {
@@ -2248,7 +2244,7 @@ function generer_form_ecrire($script, $corps, $atts = '', $submit = '') {
 	return "<form action='"
 	. ($script ? generer_url_ecrire($script) : '')
 	. "' "
-	. ($atts ? $atts : " method='post'")
+	. ($atts ?: " method='post'")
 	. "><div>\n"
 	. "<input type='hidden' name='exec' value='$script1' />"
 	. $corps
@@ -2645,7 +2641,7 @@ function spip_initialisation_core($pi = null, $pa = null, $ti = null, $ta = null
 		) {
 			if (isset($GLOBALS['meta']['adresse_site'])) {
 				$uri_ref = parse_url($GLOBALS['meta']['adresse_site']);
-				$uri_ref = (isset($uri_ref['path']) ? $uri_ref['path'] : '') . '/';
+				$uri_ref = ($uri_ref['path'] ?? '') . '/';
 			} else {
 				$uri_ref = '';
 			}
@@ -2724,7 +2720,7 @@ function spip_initialisation_suite() {
 	} # surcharge pour imagick en PHP
 
 	if (!defined('_COPIE_LOCALE_MAX_SIZE')) {
-		define('_COPIE_LOCALE_MAX_SIZE', 33554432);
+		define('_COPIE_LOCALE_MAX_SIZE', 33_554_432);
 	} // poids en octet
 
 	// qq chaines standard
@@ -3325,7 +3321,7 @@ function recuperer_fond($fond, $contexte = [], $options = [], string $connect =
 	$GLOBALS['_INC_PUBLIC']++;
 
 	// fix #4235
-	$cache_utilise_session_appelant	= (isset($GLOBALS['cache_utilise_session']) ? $GLOBALS['cache_utilise_session'] : null);
+	$cache_utilise_session_appelant	= ($GLOBALS['cache_utilise_session'] ?? null);
 
 
 	foreach (is_array($fond) ? $fond : [$fond] as $f) {
@@ -3333,7 +3329,7 @@ function recuperer_fond($fond, $contexte = [], $options = [], string $connect =
 
 		$page = evaluer_fond($f, $contexte, $connect);
 		if ($page === '') {
-			$c = isset($options['compil']) ? $options['compil'] : '';
+			$c = $options['compil'] ?? '';
 			$a = ['fichier' => $f];
 			$erreur = _T('info_erreur_squelette2', $a); // squelette introuvable
 			erreur_squelette($erreur, $c);
@@ -3518,7 +3514,7 @@ function spip_getimagesize($fichier) {
 	if (!$imagesize = @getimagesize($fichier)) {
 		include_spip('inc/svg');
 		if ($attrs = svg_lire_attributs($fichier)) {
-			list($width, $height, $viewbox) = svg_getimagesize_from_attr($attrs);
+			[$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs);
 			$imagesize = [
 				$width,
 				$height,
diff --git a/ecrire/inc/xml.php b/ecrire/inc/xml.php
index ca8ac98ea8c1d0a495154fbd05aa27eacedf8064..45c305d157460b43c83563dab6adb611372ff712 100644
--- a/ecrire/inc/xml.php
+++ b/ecrire/inc/xml.php
@@ -46,7 +46,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *     - array : l'arbre XML,
  *     - false si l'arbre xml ne peut être créé ou est vide
  **/
-function spip_xml_load($fichier, $strict = true, $clean = true, $taille_max = 1048576, $datas = '', $profondeur = -1) {
+function spip_xml_load($fichier, $strict = true, $clean = true, $taille_max = 1_048_576, $datas = '', $profondeur = -1) {
 	$contenu = '';
 	if (tester_url_absolue($fichier)) {
 		include_spip('inc/distant');
@@ -103,7 +103,7 @@ function spip_xml_parse(&$texte, $strict = true, $clean = true, $profondeur = -1
 
 	// tant qu'il y a des tags
 	$chars = preg_split(_SPIP_XML_TAG_SPLIT, $txt, 2, PREG_SPLIT_DELIM_CAPTURE);
-	while (count($chars) >= 2) {
+	while ((is_countable($chars) ? count($chars) : 0) >= 2) {
 		// tag ouvrant
 		//$chars = preg_split("{<([^>]*?)>}s",$txt,2,PREG_SPLIT_DELIM_CAPTURE);
 
@@ -128,7 +128,7 @@ function spip_xml_parse(&$texte, $strict = true, $clean = true, $profondeur = -1
 			$closing_tag = reset($closing_tag);
 			// tag fermant
 			$ncclos = strlen("</$closing_tag>");
-			$p = strpos($txt, "</$closing_tag>");
+			$p = strpos($txt, (string) "</$closing_tag>");
 			if ($p !== false and (strpos($txt, '<') < $p)) {
 				$nclose = 0;
 				$nopen = 0;
@@ -145,7 +145,7 @@ function spip_xml_parse(&$texte, $strict = true, $clean = true, $profondeur = -1
 				) {
 					$nclose++;
 					$d = $p + $ncclos;
-					$p = strpos($txt, "</$closing_tag>", $d);
+					$p = strpos($txt, (string) "</$closing_tag>", $d);
 				}
 			}
 			if ($p === false) {
@@ -268,5 +268,5 @@ function spip_xml_match_nodes($regexp, &$arbre, &$matches, $init = true) {
 		}
 	}
 
-	return (count($matches));
+	return (is_countable($matches) ? count($matches) : 0);
 }