Problem/Motivation
Running drush to send mail I see deprecation in logs because SERVER_SOFTWARE environment variable is not set.
PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in docroot/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php on line 112
the most common case is checking for updates and sending mail
Steps to reproduce
run drush to execute job to send mail and then check logs
Proposed resolution
- Use common across core the check for windows git grep PHP_OS which is substr(PHP_OS, 0, 3) == 'WIN'
- deprecate unused property in #3372667: Deprecate PHPMail::request property
- decide fate of platform in #3358248: [policy, no patch] Drop support for IIS in Drupal 11 as looks the check failing since Drupal 7 - #2983438: Truncated MailFrom address - Incorrect Windows detection
Remaining tasks
- patch
- add test and commit
User interface changes
no
API changes
no
Data model changes
no
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 3372667-2.patch | 806 bytes | andypost |
Issue fork drupal-3328187
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3328187-php-deprecated-
changes, plain diff MR !3142
Comments
Comment #3
thtas commentedRe-rolled against 9.5.x
Comment #4
enchufePatch #3 worked for me, thanks!
Comment #5
volegerComment #6
divyansh commentedI am new to the contribution and below is my first patch for this issue. I have rerolled the patch for 10.0.x.
Comment #7
divyansh commentedI have updated the patch. I have called the "request" variable from protected using "this"
Comment #8
divyansh commentedSorry for the previous patch, I missed to remove "$". I have fixed in this patch
Comment #9
volegerMethod `get` supports the second argument, NULL, by default. Passing an empty string will provide the expected behavior.
Rebased the MR and provided suggestions for the current solution.
Comment #10
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
The issue summary should be updated with steps to reproduce this issue.
We should track down what is causing this issue as this may be covering up a larger problem.
After that we need tests.
Comment #11
enchufeIssue solved in branch
9.5.x, replaced code withComment #12
rajeshreeputraComment #13
smustgrave commentedFor all the tags
Comment #14
rajeshreeputrarebased as patch failure with latest release.
Comment #16
sakthi_dev commentedPlease review.
Comment #17
borisson_For all the tags
Comment #18
andypostI filed duplicate issue #3372667: Deprecate PHPMail::request property
Probably patch could be moved here and removal of request from constructor could be done there
Comment #19
andypostIn #3372667-5: Deprecate PHPMail::request property discovered that this check probably not working for a long time, see #2983438: Truncated MailFrom address - Incorrect Windows detection
New patch from #3372667-2: Deprecate PHPMail::request property
Updated IS and steps, leaving NW for tests
Probably it should be Unit test, because other tests overriding this plugin to catch mail