Skip to content

mb_encoding_aliases(): Argument #1 ($encoding) must be of type string, null given #552

Closed

Description

@mawiswiss

Hey there,
I'm enforcing types in my project and got a new error lately concerning this package.

Uncaught TypeError: mb_encoding_aliases(): Argument #1 ($encoding) must be of type string, null given in /var/www/vendor/embed/embed/src/Document.php:49 Stack trace: #0 /var/www/vendor/embed/embed/src/Document.php(49): mb_encoding_aliases(NULL).

Our initial value should be an empty string instead of null $encoding = ''; or the function called more securely with a fallback value mb_encoding_aliases($encoding ?? '').

Pull request which fixes the issue:
#553

Activity

  1. oscarotero commented on Dec 12, 2024

    @oscarotero
    Collaborator

    Good catch. thank you

  2. NathanBaulch commented on Jun 18, 2026

    @NathanBaulch

    A related PHP7 issue was also fixed by adding Document.getValidEncoding in #559.
    Are there any plans to cut a new release? cc @uzulla

  3. oscarotero commented on Jun 19, 2026

    @oscarotero
    Collaborator

    4.4.18 released

  4. Vitorinox commented on Oct 31, 2026

    @Vitorinox
    Collaborator

    Hi @mawiswiss, thanks for the report. This was already fixed in 4.4.18: getValidEncoding now tolerates a null encoding. Please upgrade to the latest release (v4.6.0) and feel free to reopen if it still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions