Skip to content

Commit

Permalink
Enforce Swift_Spool::queueMessage() must return a boolean (see Swift_…
Browse files Browse the repository at this point in the history
…Transport_SpoolTransport::send())
  • Loading branch information
vicb committed Jan 2, 2012
1 parent 724e466 commit 36a68c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/classes/Swift/FileSpool.php
Expand Up @@ -93,15 +93,17 @@ public function queueMessage(Swift_Mime_Message $message)
/* We try an exclusive creation of the file
* This is an atomic operation, it avoid locking mechanism
*/
$fp=fopen($fileName.'.message', 'x');
if ($fp)
$fp = @fopen($fileName.'.message', 'x');
if (false !== $fp)
{
fwrite($fp, $ser);
fclose($fp);

return;
}
else
if (false === fwrite($fp, $ser))
{
return false;
}

return fclose($fp);
}
else
{
/* The file allready exists, we try a longer fileName
*/
Expand Down
3 changes: 3 additions & 0 deletions lib/classes/Swift/MemorySpool.php
Expand Up @@ -44,10 +44,13 @@ public function stop()
* Stores a message in the queue.
*
* @param Swift_Mime_Message $message The message to store
*
* @return boolean Whether the operation has succeeded
*/
public function queueMessage(Swift_Mime_Message $message)
{
$this->messages[] = $message;
return true;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/classes/Swift/Spool.php
Expand Up @@ -35,6 +35,8 @@ public function isStarted();
/**
* Queues a message.
* @param Swift_Mime_Message $message The message to store
*
* @return boolean Whether the operation has succeeded
*/
public function queueMessage(Swift_Mime_Message $message);

Expand Down

0 comments on commit 36a68c1

Please sign in to comment.