When running on CLI (for example with Drush), $_SERVER['SERVER_SOFTWARE'] is not set.

When, for example, a standard system mail is sent during the command execution, the mail() function in system.mail.inc produces the following deprecation warning:

strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated system.mail.inc:72

This is comparable to this issue. The attached patch works in a similar way to get rid of the warning.

CommentFileSizeAuthor
system.mail_.inc_.patch997 byteschase.

Comments

Chase. created an issue. See original summary.

chase.’s picture

Assigned: chase. » Unassigned
poker10’s picture

poker10’s picture

I think this fix looks good, thanks! The similar change is needed for D10 (see the parent issue), but there is a Request class used and it returns a default value in case the specific $_SERVER key is not defined. So a fix will be a bit different there.

poker10’s picture

  • mcdruid committed c8686051 on 7.x
    Issue #3348669 by Chase., poker10: system.mail.inc: strpos(): Passing...
mcdruid’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.