Skip to content

utf8_encode is deprecated in PHP 8.2 #199

Closed
@malsatin

Description

@malsatin

Is this a support request?
No

Describe the bug
Functions utf8_encode and utf8_decode were deprecated in PHP 8.2.
This SDK uses utf8_encode in one of it's functions -

$cmd = base64_encode(iconv("UTF-8", "UTF-16LE", utf8_encode($args)));
which may produce deprecation warnings.

I suggest replacing iconv("UTF-8", "UTF-16LE", utf8_encode($args)) with mb_convert_encoding($args, 'UTF-16LE', 'ISO-8859-1')

To reproduce
Make sure, that error_reporting is set to E_ALL in php.ini and call CurlEventPublisher::publish() function

Expected behavior
No warnings and exceptions are produced

Logs
You will get exception Function utf8_encode() is deprecated depending on your php configuration and logs behavior

SDK version
v6.0.2

Language version, developer tools
PHP 8.3

OS/platform
Any

Additional context
This is preventing ticket, we don't use events sending and are not affected by that deprecation

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