From 6d817993a25063d9ebf64526def2dd8e994819c0 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 20:02:37 +0200 Subject: [PATCH] Refactor I/O exceptions --- composer.json | 2 +- src/main/php/text/encode/Base64InputStream.class.php | 2 +- src/main/php/text/encode/Base64OutputStream.class.php | 2 +- src/main/php/text/encode/QuotedPrintableInputStream.class.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index e3ccd75..4b9933f 100755 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description" : "Text encoding", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "^11.0 | ^10.0", + "xp-framework/core": "^12.11 | ^11.11", "php" : ">=7.0.0" }, "require-dev" : { diff --git a/src/main/php/text/encode/Base64InputStream.class.php b/src/main/php/text/encode/Base64InputStream.class.php index 37cb589..af0d68b 100755 --- a/src/main/php/text/encode/Base64InputStream.class.php +++ b/src/main/php/text/encode/Base64InputStream.class.php @@ -19,7 +19,7 @@ class Base64InputStream implements InputStream { public function __construct(InputStream $in) { $this->in= Streams::readableFd($in); if (!stream_filter_append($this->in, 'convert.base64-decode', STREAM_FILTER_READ)) { - throw new \io\IOException('Could not append stream filter'); + throw new \io\OperationFailed('Could not append stream filter'); } } diff --git a/src/main/php/text/encode/Base64OutputStream.class.php b/src/main/php/text/encode/Base64OutputStream.class.php index 0bdc312..78d7e9e 100755 --- a/src/main/php/text/encode/Base64OutputStream.class.php +++ b/src/main/php/text/encode/Base64OutputStream.class.php @@ -21,7 +21,7 @@ public function __construct(OutputStream $out, $lineLength= 0) { $params= $lineLength ? ['line-length' => $lineLength, 'line-break-chars' => "\n"] : []; $this->out= Streams::writeableFd($out); if (!stream_filter_append($this->out, 'convert.base64-encode', STREAM_FILTER_WRITE, $params)) { - throw new \io\IOException('Could not append stream filter'); + throw new \io\OperationFailed('Could not append stream filter'); } } diff --git a/src/main/php/text/encode/QuotedPrintableInputStream.class.php b/src/main/php/text/encode/QuotedPrintableInputStream.class.php index ddaf5ee..db4ae9a 100755 --- a/src/main/php/text/encode/QuotedPrintableInputStream.class.php +++ b/src/main/php/text/encode/QuotedPrintableInputStream.class.php @@ -49,7 +49,7 @@ public function read($limit= 8192) { $o+= 1; } else { if (1 !== sscanf($h= substr($read, $o, 2), '%x', $c)) { - throw new \io\IOException('Invalid byte sequence "='.$h.'"'); + throw new \io\OperationFailed('Invalid byte sequence "='.$h.'"'); } $this->buffer.= chr($c); $o+= 2;