Match SP as per rfc2821

This commit is contained in:
ndm2 2014-03-15 11:47:13 +01:00
parent c1824071c9
commit 0ae225615c
2 changed files with 2 additions and 1 deletions

View file

@ -133,7 +133,7 @@ class SmtpTransport extends AbstractTransport {
protected function _bufferResponseLines(array $responseLines) { protected function _bufferResponseLines(array $responseLines) {
$response = array(); $response = array();
foreach ($responseLines as $responseLine) { foreach ($responseLines as $responseLine) {
if (preg_match('/^(\d{3})(?:[\s\-]+(.*))?$/', $responseLine, $match)) { if (preg_match('/^(\d{3})(?:[ -]+(.*))?$/', $responseLine, $match)) {
$response[] = array( $response[] = array(
'code' => $match[1], 'code' => $match[1],
'message' => isset($match[2]) ? $match[2] : null 'message' => isset($match[2]) ? $match[2] : null

View file

@ -431,6 +431,7 @@ class SmtpTransportTest extends CakeTestCase {
public function testBufferResponseLines() { public function testBufferResponseLines() {
$reponseLines = array( $reponseLines = array(
'123', '123',
"456\tFOO",
'FOOBAR', 'FOOBAR',
'250-PIPELINING', '250-PIPELINING',
'250-ENHANCEDSTATUSCODES', '250-ENHANCEDSTATUSCODES',