From 8742a75bac22368b97a374b16e1e53ecaee11a8e Mon Sep 17 00:00:00 2001 From: ixarlie Date: Wed, 25 Jun 2025 00:00:30 +0200 Subject: [PATCH 1/4] dummy change --- src/FdfWriter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FdfWriter.php b/src/FdfWriter.php index 9b28665..655c00c 100644 --- a/src/FdfWriter.php +++ b/src/FdfWriter.php @@ -85,7 +85,8 @@ public function save(string $filename): int|bool public static function escapePdfString(?string $string): string { // Create UTF-16BE string encode as ASCII hex - $utf16Value = mb_convert_encoding($string ?? '', 'UTF-16BE', 'UTF-8'); + $string ??= ''; + $utf16Value = mb_convert_encoding($string, 'UTF-16BE', 'UTF-8'); return strtr($utf16Value, ['(' => '\(', ')' => '\)', '\\' => '\\\\']); } From 2c25e72af98b4a49673365afe6bf6f8118a01fdf Mon Sep 17 00:00:00 2001 From: ixarlie Date: Wed, 25 Jun 2025 00:06:41 +0200 Subject: [PATCH 2/4] fix phpstan issues --- src/FdfWriter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/FdfWriter.php b/src/FdfWriter.php index 655c00c..0ffc109 100644 --- a/src/FdfWriter.php +++ b/src/FdfWriter.php @@ -85,8 +85,11 @@ public function save(string $filename): int|bool public static function escapePdfString(?string $string): string { // Create UTF-16BE string encode as ASCII hex - $string ??= ''; + $string = $string ?? ''; $utf16Value = mb_convert_encoding($string, 'UTF-16BE', 'UTF-8'); + if (false === $utf16Value) { + return $string; + } return strtr($utf16Value, ['(' => '\(', ')' => '\)', '\\' => '\\\\']); } From 3879d38ae68d1ca170956a6b285af37d7ac1c922 Mon Sep 17 00:00:00 2001 From: ixarlie Date: Wed, 25 Jun 2025 00:08:39 +0200 Subject: [PATCH 3/4] fix phpcs issues --- src/FdfWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FdfWriter.php b/src/FdfWriter.php index 0ffc109..251ddc8 100644 --- a/src/FdfWriter.php +++ b/src/FdfWriter.php @@ -85,7 +85,7 @@ public function save(string $filename): int|bool public static function escapePdfString(?string $string): string { // Create UTF-16BE string encode as ASCII hex - $string = $string ?? ''; + $string ??= $string; $utf16Value = mb_convert_encoding($string, 'UTF-16BE', 'UTF-8'); if (false === $utf16Value) { return $string; From 7a3037e0e7746e42cf1991811506cf4021e0bdb0 Mon Sep 17 00:00:00 2001 From: ixarlie Date: Wed, 25 Jun 2025 00:09:01 +0200 Subject: [PATCH 4/4] fix phpcs issues --- src/FdfWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FdfWriter.php b/src/FdfWriter.php index 251ddc8..fe2f6c0 100644 --- a/src/FdfWriter.php +++ b/src/FdfWriter.php @@ -85,7 +85,7 @@ public function save(string $filename): int|bool public static function escapePdfString(?string $string): string { // Create UTF-16BE string encode as ASCII hex - $string ??= $string; + $string ??= ''; $utf16Value = mb_convert_encoding($string, 'UTF-16BE', 'UTF-8'); if (false === $utf16Value) { return $string;