Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Component/Gettext/PoStreamWriter.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/core/lib/Drupal/Component/Gettext/PoStreamWriter.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/lib/Drupal/Component/Gettext/PoStreamWriter.php Mon Apr 23 09:46:53 2018 +0100 @@ -81,7 +81,7 @@ /** * Implements Drupal\Component\Gettext\PoStreamInterface::close(). * - * @throws Exception + * @throws \Exception * If the stream is not open. */ public function close() { @@ -89,7 +89,7 @@ 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 @@ * 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 @@ /** * 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; }