[GH-ISSUE #849] dotenv config not using env/php variables but still falling back to ini files (fix included) #497

Closed
opened 2026-02-25 21:35:11 +03:00 by kerem · 1 comment
Owner

Originally created by @jasonmunro on GitHub (Dec 21, 2023).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/849

Originally assigned to: @Shadow243 on GitHub.

modules that use "get_ini" to get module specific ini file values (like recaptcha or wordpress) try to get the values from the site config, then fallback to the ini file if present. However the code is using the full ini file name as the lookup key in the config, so it's not finding the values.

For example in the recaptcha module it is looking for "recaptcha.ini" in the config data, however that is keyed to just "recaptcha" without the ".ini" part. This fixes that for any module set using "get_ini"

diff --git a/modules/core/functions.php b/modules/core/functions.php
index 55e80b93..e59ec789 100644
--- a/modules/core/functions.php
+++ b/modules/core/functions.php
@@ -476,7 +476,7 @@ function merge_folder_list_details($folder_sources) {
 if (!hm_exists('get_ini')) {
 function get_ini($config, $name, $sections=false) {
     if (!DEBUG_MODE) {
-        $data = $config->get($name, array());
+        $data = $config->get(substr($name, 0, -4), array());
         if (is_array($data) && count($data) > 0) {
             return $data;
         }
Originally created by @jasonmunro on GitHub (Dec 21, 2023). Original GitHub issue: https://github.com/cypht-org/cypht/issues/849 Originally assigned to: @Shadow243 on GitHub. modules that use "get_ini" to get module specific ini file values (like recaptcha or wordpress) try to get the values from the site config, then fallback to the ini file if present. However the code is using the full ini file name as the lookup key in the config, so it's not finding the values. For example in the recaptcha module it is looking for "recaptcha.ini" in the config data, however that is keyed to just "recaptcha" without the ".ini" part. This fixes that for any module set using "get_ini" ``` diff --git a/modules/core/functions.php b/modules/core/functions.php index 55e80b93..e59ec789 100644 --- a/modules/core/functions.php +++ b/modules/core/functions.php @@ -476,7 +476,7 @@ function merge_folder_list_details($folder_sources) { if (!hm_exists('get_ini')) { function get_ini($config, $name, $sections=false) { if (!DEBUG_MODE) { - $data = $config->get($name, array()); + $data = $config->get(substr($name, 0, -4), array()); if (is_array($data) && count($data) > 0) { return $data; } ```
kerem closed this issue 2026-02-25 21:35:11 +03:00
Author
Owner

@Shadow243 commented on GitHub (Dec 21, 2023):

Fixed from PR: https://github.com/cypht-org/cypht/pull/846

<!-- gh-comment-id:1866782800 --> @Shadow243 commented on GitHub (Dec 21, 2023): Fixed from PR: https://github.com/cypht-org/cypht/pull/846
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#497
No description provided.