Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We had an issue setting cookies to for a Drupal installation in a subfolder ( folder/drupalroot).
This is something that the user can manually change in the config page of the module.
In our case, most of our installations are in a subfolder, and each subfolder has a different name , so we want the subfolder name to be the default value of the cookie path field instead of (/)
Proposed resolution
We need to change the default value of the cookie path field from (/) to base_path()
Remaining tasks
Create a patch ..in progress
Comment | File | Size | Author |
---|---|---|---|
#3 | set_cookie_path_root_folder_second-2882384-2.patch | 1.42 KB | Orabi |
#2 | set_cookie_path_root_folder-2882384-2.patch | 1.16 KB | Orabi |
Comments
Comment #2
Orabi CreditAttribution: Orabi as a volunteer commentedComment #3
Orabi CreditAttribution: Orabi as a volunteer commentedComment #4
Orabi CreditAttribution: Orabi as a volunteer commentedpatch #2 uses the base_path() function from drupal. that didnt work since the function language_cookie_set() is called from hook_boot , which means that we will get a fatal error ( base_path() is not defined )
Patch #3 is fixing this by using the global $base_path
Comment #5
Orabi CreditAttribution: Orabi as a volunteer commentedComment #6
PieterDCGood fix, which adheres to Drupal best practices.
Comment #7
Orabi CreditAttribution: Orabi as a volunteer commented