| @@ 398-417 (lines=20) @@ | ||
| 395 | * |
|
| 396 | * @return mixed|null|string |
|
| 397 | */ |
|
| 398 | protected function _getReversePath(Swift_Mime_Message $message) |
|
| 399 | { |
|
| 400 | $return = $message->getReturnPath(); |
|
| 401 | $sender = $message->getSender(); |
|
| 402 | $from = $message->getFrom(); |
|
| 403 | $path = null; |
|
| 404 | ||
| 405 | if (!empty($return)) { |
|
| 406 | $path = $return; |
|
| 407 | } elseif (!empty($sender)) { |
|
| 408 | // don't use array_keys |
|
| 409 | reset($sender); // reset Pointer to first pos |
|
| 410 | $path = key($sender); // get key |
|
| 411 | } elseif (!empty($from)) { |
|
| 412 | reset($from); // reset Pointer to first pos |
|
| 413 | $path = key($from); // get key |
|
| 414 | } |
|
| 415 | ||
| 416 | return $path; |
|
| 417 | } |
|
| 418 | ||
| 419 | /** |
|
| 420 | * Throw a TransportException, first sending it to any listeners. |
|
| @@ 271-288 (lines=18) @@ | ||
| 268 | * |
|
| 269 | * @return mixed|null|string |
|
| 270 | */ |
|
| 271 | private function _getReversePath(Swift_Mime_Message $message) |
|
| 272 | { |
|
| 273 | $return = $message->getReturnPath(); |
|
| 274 | $sender = $message->getSender(); |
|
| 275 | $from = $message->getFrom(); |
|
| 276 | $path = null; |
|
| 277 | if (!empty($return)) { |
|
| 278 | $path = $return; |
|
| 279 | } elseif (!empty($sender)) { |
|
| 280 | $keys = array_keys($sender); |
|
| 281 | $path = array_shift($keys); |
|
| 282 | } elseif (!empty($from)) { |
|
| 283 | $keys = array_keys($from); |
|
| 284 | $path = array_shift($keys); |
|
| 285 | } |
|
| 286 | ||
| 287 | return $path; |
|
| 288 | } |
|
| 289 | ||
| 290 | /** |
|
| 291 | * Fix CVE-2016-10074 by disallowing potentially unsafe shell characters. |
|