On 22/03/2021 18:18, Chase Peeler wrote:

Even if it is by accident, removing or changing the behavior of the function is guaranteed to make something that currently works (by skill or by luck) and risk it no longer working.


This is absolutely true. However, at some point you have to draw the line between supported use cases, and requests to re-enable spacebar heating: https://xkcd.com/1172/

I think using utf8_encode to store binary data in a text column crosses that line: the code was added because of a misunderstanding of the function, it works by accident, and there are plenty of better ways to solve the actual problem.

Just to be clear, the trick Aleksander and Alexandru stumbled on doesn't just work for "corrupted UTF-8"; you could store a JPEG in a text column by using utf8_encode(file_get_contents($image_file)). It's probably best not to, though.

I *also* agree that users should have a clear guide to how to replace their current usages. Fortunately, there are at least 4 other ways of writing this functionality in PHP (iconv, mbstring, intl, and the Symfony polyfill).

Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to