From 5fa3ecd41ad2e1dc8ced2c577bcb71070adacb10 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:28:10 +0200 Subject: [PATCH] Fix impossibility to validate objects (#35202) * Fix impossibility to validate objects * fix pre commit --------- Co-authored-by: Lucas Marcouiller --- README.md | 1 + htdocs/core/lib/functions.lib.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 3c2b2e0ac43..1161233ac3b 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ Follow these step-by-step instructions to seamlessly upgrade Dolibarr to the lat See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. +Adding new templates must be done by adding files into a module directory. Adding files into custom with same path of the core without having using a module is now forbidden ## FEATURES diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 12bbbd3dab7..01abaaf22c9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1569,6 +1569,9 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) } // if (@file_exists($dirroot.'/'.$path)) { if (@file_exists($dirroot . '/' . $path)) { // avoid [php:warn] + if ($key != 'main' && preg_match('/^core\//', $path)) { // When searching into an alternative custom path, we don't want path like 'core/...' because path should be 'modulename/core/...' + continue; + } $res = $dirroot . '/' . $path; return $res; }