mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 01:22:37 +00:00
Avoiding circular object reference in SmptTransport
This fixes a memory leak while sending multiple emails. Fixes: #9198
This commit is contained in:
parent
774af90830
commit
93db51cf10
2 changed files with 23 additions and 46 deletions
|
@ -35,16 +35,6 @@ class SmtpTestTransport extends SmtpTransport {
|
|||
$this->_socket = $socket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to change the CakeEmail
|
||||
*
|
||||
* @param object $cakeEmail An email object.
|
||||
* @return void
|
||||
*/
|
||||
public function setCakeEmail($cakeEmail) {
|
||||
$this->_cakeEmail = $cakeEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled the socket change
|
||||
*
|
||||
|
@ -348,8 +338,7 @@ class SmtpTransportTest extends CakeTestCase {
|
|||
$this->socket->expects($this->at(13))->method('read')->will($this->returnValue(false));
|
||||
$this->socket->expects($this->at(14))->method('read')->will($this->returnValue("250 OK\r\n"));
|
||||
|
||||
$this->SmtpTransport->setCakeEmail($email);
|
||||
$this->SmtpTransport->sendRcpt();
|
||||
$this->SmtpTransport->sendRcpt($email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,8 +359,7 @@ class SmtpTransportTest extends CakeTestCase {
|
|||
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
|
||||
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
|
||||
|
||||
$this->SmtpTransport->setCakeEmail($email);
|
||||
$this->SmtpTransport->sendRcpt();
|
||||
$this->SmtpTransport->sendRcpt($email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -416,8 +404,7 @@ class SmtpTransportTest extends CakeTestCase {
|
|||
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
|
||||
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
|
||||
|
||||
$this->SmtpTransport->setCakeEmail($email);
|
||||
$this->SmtpTransport->sendData();
|
||||
$this->SmtpTransport->sendData($email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -498,8 +485,7 @@ class SmtpTransportTest extends CakeTestCase {
|
|||
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
|
||||
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
|
||||
|
||||
$this->SmtpTransport->setCakeEmail($email);
|
||||
$this->SmtpTransport->sendRcpt();
|
||||
$this->SmtpTransport->sendRcpt($email);
|
||||
|
||||
$expected = array(
|
||||
array('code' => '250', 'message' => 'OK'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue