mail function does not detect Windows

Created on 13 November 2023, about 1 year ago
Updated 21 November 2023, 12 months ago

Problem/Motivation

The mail function fails to detect that Drupal is running on Windows.

Problem

Line 72 of system.mail.inc tests if Drupal is NOT running on Windows with

if (!isset($_SERVER['WINDIR']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Win32') === FALSE) {

There are two problems with this. The environment variable is (at least on non-ancient Windows versions) windir, not WINDIR. Secondly $_SERVER['SERVER_SOFTWARE'] holds the name of the web server software, e.g. Microsoft-IIS/8.5, not the OS as the test presumes.

Proposed resolution

Replace the line with, for example

if (stripos(PHP_OS, 'WIN') === FALSE) {

🐛 Bug report
Status

Needs review

Version

7.0 ⚰️

Component
Mail 

Last updated 8 days ago

No maintainer
Created by

🇸🇪Sweden SuneK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024