prooph / docker-files

Collection of prooph docker files
http://getprooph.org
249 stars 89 forks source link

Iconv problem #24

Open prolic opened 6 years ago

prolic commented 6 years ago

Test-Case: php -d error_reporting=22527 -d display_errors=1 -r 'var_dump(iconv("UTF-8", "UTF-8//IGNORE", "This is the Euro symbol '\''€'\''."));'

output: Notice: iconv(): Wrong charset, conversion fromUTF-8' to UTF-8//IGNORE' is not allowed in Command line code on line 1

So I customized the dockerfile to:

FROM prooph/php:7.1-fpm-opcache
RUN apk add gnu-libiconv --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

Let's test this:

output: string(30) "This is the Euro symbol '€'."

sandrokeil commented 6 years ago

I think the LD_PRELOAD fix is not a good solution for our prooph Docker images. Maybe mb_convert_encoding($text, 'UTF-8', 'UTF-8'); does the same if you want to remove invalid UTF-8 characters?

prolic commented 6 years ago

I ran into this issue due to work, not sure if this happened in their code or in third party library. Would need to double check.

Sascha-Oliver Prolic

2018-08-03 1:09 GMT+08:00 Sandro Keil notifications@github.com:

I think the LD_PRELOAD fix is not a good solution for our prooph Docker images. Maybe mb_convert_encoding($text, 'UTF-8', 'UTF-8'); does the same if you want to remove invalid UTF-8 characters?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/prooph/docker-files/issues/24#issuecomment-410000107, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYEvDrFXtIhrhwdEwkEXStbKHefHJICks5uMzJRgaJpZM4VsZjQ .

prolic commented 6 years ago

I checked again, the iconv stuff is used by wordpress.

sandrokeil commented 6 years ago

Ok but I don't know how to solve this and I think it's not related for our Docker images, because they are only intended for development and may be only a blueprint for production.

prolic commented 6 years ago

I never said the word production. Iconv is used by wordpress. This is also true for development mode. So I can't use these docker images for a local wp installation. With the fix i provided it works.

On Fri, Aug 3, 2018, 23:27 Sandro Keil notifications@github.com wrote:

Ok but I don't know how to solve this and I think it's not related for our Docker images, because they are only intended for development and may be only a blueprint for production.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/prooph/docker-files/issues/24#issuecomment-410288979, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYEvDRfpCUTOsuTXAE4T4BMLQnUKHTFks5uNGvggaJpZM4VsZjQ .

sandrokeil commented 2 years ago

Maybe this is solved in the new Docker images >= PHP 7.4 with Alpine 3.15.