Skip to content

Commit

Permalink
[+]: "Error when sending with php-cli due to SERVER_NAME empty"
Browse files Browse the repository at this point in the history
  • Loading branch information
voku committed Sep 21, 2017
1 parent 2a7c650 commit e0e3d75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dependency_maps/transport_deps.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// preg_replace() instead of preg_match() to prevent DoS attacks with long host names.
//
// TODO: -> SECURITY | https://github.com/kalessil/phpinspectionsea/issues/302
->asValue(!empty($_SERVER['SERVER_NAME']) && preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) === '' ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1')
->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '[]') : (gethostname() ?: '127.0.0.1' ))

->register('transport.smtp')
->asNewInstanceOf('Swift_Transport_EsmtpTransport')
Expand Down

0 comments on commit e0e3d75

Please sign in to comment.