laminas / laminas-stdlib

SPL extensions, array utilities, error handlers, and more
https://docs.laminas.dev/laminas-stdlib/
BSD 3-Clause "New" or "Revised" License
190 stars 40 forks source link

mb_convert_encoding with html-entities deprecated in php 8.2 #87

Closed siliconalchemy closed 1 year ago

siliconalchemy commented 1 year ago

Bug Report

Q A
Version(s) 3.17.0

Summary

StringWrapper\Mbstring breaks in php 8.2

Current behavior

Exception #0 (Exception): Deprecated Functionality: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in ...vendor/laminas/laminas-stdlib/src/StringWrapper/MbString.php on line 125

How to reproduce

        $this->mbString->setEncoding('UTF-8', 'html-entities');
        $result = $this->mbString->convert($result);

Expected behavior

No error!

Xerkus commented 1 year ago

This is PHP deprecation. You will have to migrate away from using html-entities with mbstring.

siliconalchemy commented 1 year ago

But shouldn't this be fixed in StringWrapper/MbString.php? This contains mb_convert_encoding() which is deprecated?

Xerkus commented 1 year ago

mb_convert_encoding() is not deprecated. Using it for html-entities is.

siliconalchemy commented 1 year ago

Oh duh. Right, sorry :)