Skip to content
Extraits de code Groupes Projets
Valider 43b3387e rédigé par marcimat's avatar marcimat
Parcourir les fichiers

fix: include_spip retournait toujours un chemin relatif. Faisons pareil.

parent 152f8d3e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -269,7 +269,7 @@ function find_in_path(string $file, string $dirname = '', bool|string $include = ...@@ -269,7 +269,7 @@ function find_in_path(string $file, string $dirname = '', bool|string $include =
} }
$path = $loader->get($file); $path = $loader->get($file);
// find in path retourne des chemins relatif, si possible
if ($path !== null && str_starts_with($path, _ROOT_RACINE)) { if ($path !== null && str_starts_with($path, _ROOT_RACINE)) {
$path = _DIR_RACINE . substr($path, strlen(_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 = ...@@ -279,11 +279,14 @@ function find_in_path(string $file, string $dirname = '', bool|string $include =
} }
if ($include === true) { if ($include === true) {
return $path !== null ? $loader->include($file) : null; if ($path === null) {
return null;
}
return $loader->include($file) ? $path : null;
} }
if ($include === 'required') { 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)); throw new \InvalidArgumentException(sprintf('$include argument with "%s" value is incorrect.', $include));
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter