diff --git a/5.6/Dockerfile b/5.6/Dockerfile index b7e3661..3be4978 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -36,7 +36,9 @@ RUN apk add --no-cache \ php5-xml \ php5-xmlreader \ php5-zip \ - php5-zlib + php5-zlib \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + gnu-libiconv # install and remove building packages ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c php5-dev php5-pear \ @@ -63,3 +65,6 @@ ARG VCS_REF LABEL org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/5.6/Dockerfile.debug b/5.6/Dockerfile.debug index 3a72828..eca1f41 100644 --- a/5.6/Dockerfile.debug +++ b/5.6/Dockerfile.debug @@ -37,7 +37,9 @@ RUN apk add --no-cache \ php5-xml \ php5-xmlreader \ php5-zip \ - php5-zlib + php5-zlib \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + gnu-libiconv # install and remove building packages ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c php5-dev php5-pear \ @@ -66,3 +68,6 @@ ARG VCS_REF LABEL org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/5.6/php5.6.bats b/5.6/php5.6.bats index d2f6ef0..df1ecfb 100755 --- a/5.6/php5.6.bats +++ b/5.6/php5.6.bats @@ -151,3 +151,20 @@ readonly container="graze/php-alpine:5.6" [ "$status" -eq 0 ] [ "$output" = "memory_limit => 1024M => 1024M" ] } + +@test "the image uses a fixed iconv module" { + run bash -c "docker inspect ${container} | jq -r '.[]?.Config.Env[]'" + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [[ "${output}" == *"LD_PRELOAD=/usr/lib/preloadable_libiconv.so php"* ]] +} + +@test "iconv works" { + run docker run ${container} php -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "foobar");' + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [ "$output" = "foobar" ] + [[ "${output}" != *"PHP Notice"* ]] +} diff --git a/5.6/php5.6_debug.bats b/5.6/php5.6_debug.bats index 8211364..fa47551 100755 --- a/5.6/php5.6_debug.bats +++ b/5.6/php5.6_debug.bats @@ -152,3 +152,20 @@ readonly container="graze/php-alpine:5.6-test" [ "$status" -eq 0 ] [ "$output" = "memory_limit => 1024M => 1024M" ] } + +@test "the image uses a fixed iconv module" { + run bash -c "docker inspect ${container} | jq -r '.[]?.Config.Env[]'" + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [[ "${output}" == *"LD_PRELOAD=/usr/lib/preloadable_libiconv.so php"* ]] +} + +@test "iconv works" { + run docker run ${container} php -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "foobar");' + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [ "$output" = "foobar" ] + [[ "${output}" != *"PHP Notice"* ]] +} diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 51e6f6a..5d92c48 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -41,7 +41,9 @@ RUN apk add --no-cache \ php7-xml \ php7-xmlreader \ php7-zip \ - php7-zlib + php7-zlib \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + gnu-libiconv # install and remove building packages ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c php7-dev php7-pear \ @@ -72,3 +74,6 @@ ARG VCS_REF LABEL org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/7.0/Dockerfile.debug b/7.0/Dockerfile.debug index 338ae00..f8a436f 100644 --- a/7.0/Dockerfile.debug +++ b/7.0/Dockerfile.debug @@ -42,7 +42,9 @@ RUN apk add --no-cache \ php7-xml \ php7-xmlreader \ php7-zip \ - php7-zlib + php7-zlib \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + gnu-libiconv # install and remove building packages ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c php7-dev php7-pear \ @@ -73,3 +75,6 @@ ARG VCS_REF LABEL org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/7.0/php7.0.bats b/7.0/php7.0.bats index d1a096b..a58c236 100755 --- a/7.0/php7.0.bats +++ b/7.0/php7.0.bats @@ -151,3 +151,20 @@ readonly container="graze/php-alpine:7.0" [ "$status" -eq 0 ] [ "$output" = "memory_limit => 1024M => 1024M" ] } + +@test "the image uses a fixed iconv module" { + run bash -c "docker inspect ${container} | jq -r '.[]?.Config.Env[]'" + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [[ "${output}" == *"LD_PRELOAD=/usr/lib/preloadable_libiconv.so php"* ]] +} + +@test "iconv works" { + run docker run ${container} php -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "foobar");' + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [ "$output" = "foobar" ] + [[ "${output}" != *"PHP Notice"* ]] +} diff --git a/7.0/php7.0_debug.bats b/7.0/php7.0_debug.bats index f1d9926..c110a79 100755 --- a/7.0/php7.0_debug.bats +++ b/7.0/php7.0_debug.bats @@ -159,3 +159,20 @@ readonly container="graze/php-alpine:7.0-test" [ "$status" -eq 0 ] [ "$output" = "memory_limit => 1024M => 1024M" ] } + +@test "the image uses a fixed iconv module" { + run bash -c "docker inspect ${container} | jq -r '.[]?.Config.Env[]'" + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [[ "${output}" == *"LD_PRELOAD=/usr/lib/preloadable_libiconv.so php"* ]] +} + +@test "iconv works" { + run docker run ${container} php -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "foobar");' + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [ "$output" = "foobar" ] + [[ "${output}" != *"PHP Notice"* ]] +} diff --git a/7.1/Dockerfile b/7.1/Dockerfile index ea13bac..671ba56 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -46,7 +46,9 @@ RUN apk add --no-cache \ php7-xmlreader \ php7-xmlwriter \ php7-zip \ - php7-zlib + php7-zlib \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + gnu-libiconv # install and remove building packages ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c php7-dev php7-pear \ @@ -73,3 +75,6 @@ ARG VCS_REF LABEL org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/7.1/Dockerfile.debug b/7.1/Dockerfile.debug index 8a67656..81a52bc 100644 --- a/7.1/Dockerfile.debug +++ b/7.1/Dockerfile.debug @@ -47,7 +47,9 @@ RUN apk add --no-cache \ php7-xmlreader \ php7-xmlwriter \ php7-zip \ - php7-zlib + php7-zlib \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + gnu-libiconv # install and remove building packages ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c php7-dev php7-pear \ @@ -74,3 +76,6 @@ ARG VCS_REF LABEL org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.build-date=$BUILD_DATE + +# Fix for iconv: https://github.com/docker-library/php/issues/240 +ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php diff --git a/7.1/php7.1.bats b/7.1/php7.1.bats index 30e37d0..ae5dc16 100755 --- a/7.1/php7.1.bats +++ b/7.1/php7.1.bats @@ -151,3 +151,20 @@ readonly container="graze/php-alpine:7.1" [ "$status" -eq 0 ] [ "$output" = "memory_limit => 1024M => 1024M" ] } + +@test "the image uses a fixed iconv module" { + run bash -c "docker inspect ${container} | jq -r '.[]?.Config.Env[]'" + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [[ "${output}" == *"LD_PRELOAD=/usr/lib/preloadable_libiconv.so php"* ]] +} + +@test "iconv works" { + run docker run ${container} php -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "foobar");' + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [ "$output" = "foobar" ] + [[ "${output}" != *"PHP Notice"* ]] +} diff --git a/7.1/php7.1_debug.bats b/7.1/php7.1_debug.bats index d3326a0..b09fd5c 100755 --- a/7.1/php7.1_debug.bats +++ b/7.1/php7.1_debug.bats @@ -159,3 +159,20 @@ readonly container="graze/php-alpine:7.1-test" [ "$status" -eq 0 ] [ "$output" = "memory_limit => 1024M => 1024M" ] } + +@test "the image uses a fixed iconv module" { + run bash -c "docker inspect ${container} | jq -r '.[]?.Config.Env[]'" + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [[ "${output}" == *"LD_PRELOAD=/usr/lib/preloadable_libiconv.so php"* ]] +} + +@test "iconv works" { + run docker run ${container} php -r 'echo iconv("UTF-8", "ASCII//TRANSLIT", "foobar");' + echo "status: $status" + echo "output: $output" + [ "$status" -eq 0 ] + [ "$output" = "foobar" ] + [[ "${output}" != *"PHP Notice"* ]] +}