Skip to content

Commit

Permalink
iconv: Fix warning on PHP 8.2
Browse files Browse the repository at this point in the history
    Deprecated: iconv(): Passing null to parameter #1 ($from_encoding) of type string is deprecated in src/IconvTranscoder.php on line 49
  • Loading branch information
jtojnar committed Mar 7, 2023
1 parent 446f0b1 commit 2e1d8fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## unreleased

- Iconv: Fix warning on PHP 8.2 when passing `null` as source encoding.


## [1.0.1] – 2021-05-23

The project has been revived and is now available under the name [`fossar/transcoder`](https://packagist.org/packages/fossar/transcoder). This is a first release since the fork.
Expand Down
2 changes: 1 addition & 1 deletion src/IconvTranscoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function ($no, $message) use ($string) {
);

try {
$result = iconv($from, $to ?: $this->defaultEncoding, $string);
$result = iconv($from ?: '', $to ?: $this->defaultEncoding, $string);
} finally {
restore_error_handler();
}
Expand Down

0 comments on commit 2e1d8fd

Please sign in to comment.