From 43b3387ea9f595f5e1fee67913e6e15946bdd4df Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Thu, 21 Dec 2023 18:14:33 +0100
Subject: [PATCH] fix: include_spip retournait toujours un chemin relatif.
 Faisons pareil.

---
 ecrire/bootstrap/inc/path.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ecrire/bootstrap/inc/path.php b/ecrire/bootstrap/inc/path.php
index 6c2a505b09..6044238fd8 100644
--- a/ecrire/bootstrap/inc/path.php
+++ b/ecrire/bootstrap/inc/path.php
@@ -269,7 +269,7 @@ function find_in_path(string $file, string $dirname = '', bool|string $include =
 	}
 
 	$path = $loader->get($file);
-
+	// find in path retourne des chemins relatif, si possible
 	if ($path !== null && str_starts_with($path, _ROOT_RACINE)) {
 		$path = _DIR_RACINE . substr($path, strlen(_ROOT_RACINE));
 	}
@@ -279,11 +279,14 @@ function find_in_path(string $file, string $dirname = '', bool|string $include =
 	}
 
 	if ($include === true) {
-		return $path !== null ? $loader->include($file) : null;
+		if ($path === null) {
+			return null;
+		}
+		return $loader->include($file) ? $path : null;
 	}
 
 	if ($include === 'required') {
-		return $loader->require($file);
+		return $loader->require($file) ? $path : null;
 	}
 
 	throw new \InvalidArgumentException(sprintf('$include argument with "%s" value is incorrect.', $include));
-- 
GitLab