-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated #2926
Comments
Instead of directly fixing the code, lets see what happens here! So maybe it is good to check your own code and see if you are doing the right thing... |
Also another point on your code:
This seems illogical to me. Since the PHPMailer "send()" function may return |
We can't use Generally speaking, this is a developer error - PHPMailer doesn't support In your code, you could fix this by doing this:
Also, as @XL-2000 said, you are discarding any error information when you return |
Problem description
Whenever I try to send an email using SMTP, I receive this error:
Code to reproduce
This is the custom class I'm using to send the email on
php8.1
Suggestion
It may be useful to replace this line with the following code:
Also, it may be usefult to replace this line eith the following code:
This way both function will return
false
if either$text
or$str
are null without causing the deprecation error.The text was updated successfully, but these errors were encountered: