X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Flib%2FDrupal%2FComponent%2FGettext%2FPoStreamWriter.php;fp=web%2Fcore%2Flib%2FDrupal%2FComponent%2FGettext%2FPoStreamWriter.php;h=1e3f3871e3991a77c9cd015f2f1bc56d0ee9622e;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=5419b210aafbd29bd34d05a144063b561fcb55c7;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/core/lib/Drupal/Component/Gettext/PoStreamWriter.php b/web/core/lib/Drupal/Component/Gettext/PoStreamWriter.php index 5419b210a..1e3f3871e 100644 --- a/web/core/lib/Drupal/Component/Gettext/PoStreamWriter.php +++ b/web/core/lib/Drupal/Component/Gettext/PoStreamWriter.php @@ -81,7 +81,7 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface { /** * Implements Drupal\Component\Gettext\PoStreamInterface::close(). * - * @throws Exception + * @throws \Exception * If the stream is not open. */ public function close() { @@ -89,7 +89,7 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface { fclose($this->_fd); } else { - throw new Exception('Cannot close stream that is not open.'); + throw new \Exception('Cannot close stream that is not open.'); } } @@ -100,13 +100,13 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface { * Piece of string to write to the stream. If the value is not directly a * string, casting will happen in writing. * - * @throws Exception + * @throws \Exception * If writing the data is not possible. */ private function write($data) { $result = fwrite($this->_fd, $data); - if ($result === FALSE) { - throw new Exception('Unable to write data: ' . substr($data, 0, 20)); + if ($result === FALSE || $result != strlen($data)) { + throw new \Exception('Unable to write data: ' . substr($data, 0, 20)); } } @@ -137,12 +137,12 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface { /** * Implements Drupal\Component\Gettext\PoStreamInterface::getURI(). * - * @throws Exception + * @throws \Exception * If the URI is not set. */ public function getURI() { if (empty($this->_uri)) { - throw new Exception('No URI set.'); + throw new \Exception('No URI set.'); } return $this->_uri; }