| @@ 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. |
|
| @@ 411-430 (lines=20) @@ | ||
| 408 | * |
|
| 409 | * @return mixed|null|string |
|
| 410 | */ |
|
| 411 | protected function _getReversePath(Swift_Mime_Message $message) |
|
| 412 | { |
|
| 413 | $return = $message->getReturnPath(); |
|
| 414 | $sender = $message->getSender(); |
|
| 415 | $from = $message->getFrom(); |
|
| 416 | $path = null; |
|
| 417 | ||
| 418 | if (!empty($return)) { |
|
| 419 | $path = $return; |
|
| 420 | } elseif (!empty($sender)) { |
|
| 421 | // don't use array_keys |
|
| 422 | reset($sender); // reset Pointer to first pos |
|
| 423 | $path = key($sender); // get key |
|
| 424 | } elseif (!empty($from)) { |
|
| 425 | reset($from); // reset Pointer to first pos |
|
| 426 | $path = key($from); // get key |
|
| 427 | } |
|
| 428 | ||
| 429 | return $path; |
|
| 430 | } |
|
| 431 | ||
| 432 | /** |
|
| 433 | * Throw a TransportException, first sending it to any listeners. |
|