Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Bitbucket Pipelines PHP Iconv Issue

Edited

I'm running PHPUnit tests inside the Pipeline and one of the tests is using the iconv ext. to convert for example a german "ä" into "ae". Inside the Pipeline (based on PHP 7.2) this test return always a empty string.

My last try:

image: php:7.2-cli
pipelines:
default:
- step:
caches:
- composer
script:
- apt-get clean
- apt-get update -y
- apt-get install -y locales unzip zlib1g-dev libicu-dev
- printf 'en_US.UTF-8 UTF-8\n' >> /etc/locale.gen
- locale-gen
- dpkg-reconfigure --frontend noninteractive locales
- docker-php-ext-install bcmath
- docker-php-ext-enable bcmath
- docker-php-ext-install intl
- docker-php-ext-enable intl
- docker-php-ext-install mbstring
- docker-php-ext-enable mbstring
- docker-php-ext-install iconv
- docker-php-ext-enable iconv
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- vendor/bin/phpunit

 The test script:

echo iconv('UTF-8', 'ASCII//TRANSLIT', 'ÄäÖöÜü');

Expected: 'AaOoUu'
Actual: ''

1 answer

My problem was with phpunit and some env config. If I executed plain php it will work. To make my tests pass what finally worked was:

apt-get install locales

localedef -i en_US -f UTF-8 en_US.UTF-8

 

For anyone needing the full script to run a symfony project:

- echo "memory_limit = 512M" > $PHP_INI_DIR/conf.d/php-memory-limits.ini
- apt-get update && apt-get install -y libc-bin libonig-dev libfreetype-dev libjpeg62-turbo-dev libpng-dev default-mysql-client unzip libicu-dev locales
- docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install -j$(nproc) gd
- docker-php-ext-install pdo_mysql
- docker-php-ext-configure intl && docker-php-ext-install intl
- pecl install mailparse && docker-php-ext-enable mailparse
- localedef -i en_US -f UTF-8 en_US.UTF-8
# app config
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- cp app/config/parameters.yml.dist app/config/parameters.yml
- export SYMFONY_ENV=test
- composer require composer/package-versions-deprecated
- cp phpunit.xml.dist phpunit.xml
- vendor/bin/phpunit
- vendor/bin/phpstan analyse src
- echo "DONE!"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events