Skip to content
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

Disable function mail #52

Closed
wants to merge 6 commits into from
Closed

Disable function mail #52

wants to merge 6 commits into from

Conversation

mzk
Copy link
Contributor

@mzk mzk commented Jul 3, 2018

  • bug fix
  • BC break? no

While is the function mail() disabled, the condition if ($res === false) { isn't catched.
The code will pass silently, but the email is not sent.

I'm not sure, how to fix. (in nette/mail or in Nette/Utils). Thanks for help.

@dg
Copy link
Member

dg commented Jul 3, 2018

IMHO function_exists('mail') should return false.

.travis.yml Outdated
@@ -12,6 +12,7 @@ install:

script:
- vendor/bin/tester tests -s
- php -c tests/disable-mail.ini tests/Mail/SendmailMailer.phpt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add another script. You may use @phpIni disable_function=mail annotation in test.

@@ -29,6 +29,9 @@ class SendmailMailer implements IMailer
*/
public function send(Message $mail): void
{
if (function_exists('mail') === false) {
throw new SendException('Unable to send email: mail() has been disabled for security reasons.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would not print the reason. has been disabled. is IMHO enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@milo fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/mzk/mail/commits/disable-function-mail tady ten commit je, ale v pull requestu se neobjevil

Copy link
Contributor Author

@mzk mzk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@dg dg closed this in 0f98357 Jul 16, 2018
dg pushed a commit that referenced this pull request Jul 16, 2018
dg pushed a commit that referenced this pull request Jul 16, 2018
dg pushed a commit that referenced this pull request Jul 16, 2018
@mzk mzk deleted the disable-function-mail branch July 16, 2018 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants