Report any technical problems you discover and discuss solutions.

v3: folder library including config.php

Plus d'informations
il y a 10 ans 11 mois #2967 par jayaich
v3: folder library including config.php a été créé par jayaich
Hello,

We have set the PHP open_basedir option and have noticed some warnings of files being opened outside of the basedir directories. These seem to come from the file 'website_code/php/display_library.php', when 'file_exists' is called. However, the code runs further checks to locate 'config.php' and these are successful (and give no warnings):
Code:
if (file_exists('../../../config.php')) { require_once('../../../config.php'); } elseif (file_exists(dirname(__FILE__) . '/../../config.php')) { require_once(dirname(__FILE__) . '/../../config.php'); } else { require_once('config.php'); }

It seems that many files use '../../../config.php', but these are all three levels down, so they work. It seems that it is used in only two places where the files are two levels down. One is the 'display_library' file mentioned above, but that caters for the potential problem.
The second is the file 'website_code/php/folder_library.php', and this file does no extra checking. It just uses:
Code:
require_once('../../../config.php');

This will fail, and cause php warnings being outside of our web root area. The file should include further location checks the same as the 'display_library' file.

Obviously not setting 'open_basedir' avoids any warnings, but the 'require_once' call in the 'folder_library' file will still fail since the 'config.php' file does not exist in the location it is checking.


John.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 10 ans 11 mois #2970 par julten
Réponse de julten sur le sujet v3: folder library including config.php
Hello, thanks: I have commited that change.
Les utilisateur(s) suivant ont remercié: jayaich

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: ronmjultenJohnSmith
Temps de génération de la page : 0.121 secondes
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo