derickr / pecl-translit Goto Github PK
View Code? Open in Web Editor NEWTransliteration extension for PHP
License: BSD 2-Clause "Simplified" License
Transliteration extension for PHP
License: BSD 2-Clause "Simplified" License
Currently seems the build fails on macOS:
==> Installing kabel/pecl/php-translit
==> Downloading https://pecl.php.net/get/translit-0.6.3.tgz
######################################################################## 100.0%
==> /usr/local/opt/php/bin/phpize
==> ./configure --with-php-config=/usr/local/opt/php/bin/php-config
==> make
Last 15 lines from /Users/glen/Library/Logs/Homebrew/php-translit/03.make:
/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/translit.c:130:8: error: use of undeclared identifier 'num_key'
ulong num_key;
^
/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/translit.c:187:41: error: use of undeclared identifier 'num_key'
ZEND_HASH_FOREACH_KEY_VAL(target_hash, num_key, key, val) {
^
4 errors generated.
make: *** [translit.lo] Error 1
make: *** Waiting for unfinished jobs....
clang -I. -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -DPHP_ATOM_INC -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/include -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/main -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -I/usr/local/Cellar/php/7.4.2/include/php -I/usr/local/Cellar/php/7.4.2/include/php/main -I/usr/local/Cellar/php/7.4.2/include/php/TSRM -I/usr/local/Cellar/php/7.4.2/include/php/Zend -I/usr/local/Cellar/php/7.4.2/include/php/ext -I/usr/local/Cellar/php/7.4.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/data/normalize_ligature.c -fno-common -DPIC -o data/.libs/normalize_ligature.o
clang -I. -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -DPHP_ATOM_INC -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/include -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/main -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -I/usr/local/Cellar/php/7.4.2/include/php -I/usr/local/Cellar/php/7.4.2/include/php/main -I/usr/local/Cellar/php/7.4.2/include/php/TSRM -I/usr/local/Cellar/php/7.4.2/include/php/Zend -I/usr/local/Cellar/php/7.4.2/include/php/ext -I/usr/local/Cellar/php/7.4.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/data/hebrew_transliterate.c -fno-common -DPIC -o data/.libs/hebrew_transliterate.o
clang -I. -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -DPHP_ATOM_INC -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/include -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/main -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -I/usr/local/Cellar/php/7.4.2/include/php -I/usr/local/Cellar/php/7.4.2/include/php/main -I/usr/local/Cellar/php/7.4.2/include/php/TSRM -I/usr/local/Cellar/php/7.4.2/include/php/Zend -I/usr/local/Cellar/php/7.4.2/include/php/ext -I/usr/local/Cellar/php/7.4.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/data/lowercase_cyrillic.c -fno-common -DPIC -o data/.libs/lowercase_cyrillic.o
clang -I. -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -DPHP_ATOM_INC -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/include -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/main -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -I/usr/local/Cellar/php/7.4.2/include/php -I/usr/local/Cellar/php/7.4.2/include/php/main -I/usr/local/Cellar/php/7.4.2/include/php/TSRM -I/usr/local/Cellar/php/7.4.2/include/php/Zend -I/usr/local/Cellar/php/7.4.2/include/php/ext -I/usr/local/Cellar/php/7.4.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/data/lowercase_latin.c -fno-common -DPIC -o data/.libs/lowercase_latin.o
clang -I. -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -DPHP_ATOM_INC -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/include -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/main -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -I/usr/local/Cellar/php/7.4.2/include/php -I/usr/local/Cellar/php/7.4.2/include/php/main -I/usr/local/Cellar/php/7.4.2/include/php/TSRM -I/usr/local/Cellar/php/7.4.2/include/php/Zend -I/usr/local/Cellar/php/7.4.2/include/php/ext -I/usr/local/Cellar/php/7.4.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/data/normalize_punctuation.c -fno-common -DPIC -o data/.libs/normalize_punctuation.o
clang -I. -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -DPHP_ATOM_INC -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/include -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/main -I/private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3 -I/usr/local/Cellar/php/7.4.2/include/php -I/usr/local/Cellar/php/7.4.2/include/php/main -I/usr/local/Cellar/php/7.4.2/include/php/TSRM -I/usr/local/Cellar/php/7.4.2/include/php/Zend -I/usr/local/Cellar/php/7.4.2/include/php/ext -I/usr/local/Cellar/php/7.4.2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php-translit-20200214-24987-vspu4t/translit-0.6.3/data/lowercase_greek.c -fno-common -DPIC -o data/.libs/lowercase_greek.o
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/kabel/homebrew-pecl/issues
[~/scm/brew/homebrew-pecl/Formula (ext-translit)] ➔
Hello, Derick! Thank you for maintaining this extension!
I'm having a problem with translit
extension in my Alpine based PHP docker image.
I am getting segmentation fault error when calling the transliterate
method:
(gdb) run -r "echo transliterate('тест', ['cyrillic_transliterate'], 'utf-8', 'utf-8') . PHP_EOL;"
Starting program: /usr/local/bin/php -r "echo transliterate('тест', ['cyrillic_transliterate'], 'utf-8', 'utf-8') . PHP_EOL;"
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff45bdbb9 in zif_transliterate () from /usr/local/lib/php/extensions/no-debug-non-zts-20180731/translit.so
(gdb) bt
#0 0x00007ffff45bdbb9 in zif_transliterate () from /usr/local/lib/php/extensions/no-debug-non-zts-20180731/translit.so
#1 0x0000555555a0e9fe in execute_ex ()
#2 0x0000555555a11722 in zend_execute ()
#3 0x000055555597cb27 in zend_eval_stringl ()
#4 0x000055555597cc09 in zend_eval_stringl_ex ()
#5 0x0000555555a13993 in ?? ()
#6 0x00005555556ae94b in ?? ()
#7 0x00007ffff7f83a03 in ?? () from /lib/ld-musl-x86_64.so.1
#8 0x00007ffff7f839dc in ?? () from /lib/ld-musl-x86_64.so.1
#9 0x00007fffffffd120 in ?? ()
#10 0x0000000000000000 in ?? ()
(gdb)
But when I omit the last utf-8
argument, then the problem disappears:
(gdb) run -r "echo transliterate('тест', ['cyrillic_transliterate'], 'utf-8') . PHP_EOL;"
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/local/bin/php -r "echo transliterate('тест', ['cyrillic_transliterate'], 'utf-8') . PHP_EOL;"
test
[Inferior 1 (process 299) exited normally]
My docker image:
######## ## ## #### ## ######## ######## ########
## ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
######## ## ## ## ## ## ## ###### ########
## ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
######## ####### #### ######## ######## ######## ## ##
FROM php:7.3-fpm-alpine AS builder
ENV CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS"
# Install dev libraries
RUN set -eux ;\
apk --update upgrade ;\
apk add --no-cache \
build-base \
autoconf \
zlib-dev \
libzip-dev \
bzip2-dev \
libxslt-dev \
tidyhtml-dev \
curl-dev \
libedit-dev \
musl-libintl \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
freetype-dev \
icu-dev \
imap-dev \
krb5-dev \
libmemcached-dev \
imagemagick-dev \
libtool
# Install builtin PHP extensions
RUN set -eux ;\
docker-php-ext-install -j$(nproc) \
bcmath \
zip \
bz2 \
mbstring \
pcntl \
xsl \
tidy \
curl \
pdo \
pdo_mysql \
dom \
xml \
xmlrpc \
simplexml \
readline \
soap \
tokenizer \
ctype \
calendar \
sysvmsg \
sysvsem \
sysvshm \
shmop \
gettext \
fileinfo \
sockets \
opcache \
;\
docker-php-ext-configure exif --enable-exif ;\
docker-php-ext-install -j$(nproc) exif ;\
docker-php-ext-configure intl --enable-intl ;\
docker-php-ext-install -j$(nproc) intl ;\
docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ \
--with-webp-dir=/usr/include/ \
--with-xpm-dir=/usr/include/ \
;\
docker-php-ext-install -j$(nproc) gd ;\
docker-php-ext-configure imap --with-kerberos --with-imap-ssl ;\
docker-php-ext-install -j$(nproc) imap
# Install PHP extensions from PECL
RUN set -eux ;\
pecl install -o -f \
imagick-3.4.4 \
memcached-3.1.3 \
igbinary-3.0.1 \
msgpack-2.0.3 \
redis-4.3.0 \
translit-0.6.3 \
;\
docker-php-ext-enable \
imagick \
memcached \
igbinary \
msgpack \
redis \
translit
RUN apk add --no-cache bash
######## ### ######## ###### ######## ########
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
## ## ## ######## ## #### ###### ##
## ######### ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ###### ######## ##
FROM php:7.3-fpm-alpine
# Install runtime libraries and update certs
RUN set -eux ;\
apk --update upgrade ;\
apk add --no-cache \
ca-certificates \
zlib \
libzip \
bzip2 \
libxslt \
tidyhtml-libs \
curl \
readline \
libpng \
libwebp \
libxpm \
freetype \
imagemagick \
libmemcached-libs \
c-client \
icu-libs \
redis \
ghostscript \
ghostscript-fonts \
ttf-dejavu \
librsvg \
musl-locales \
ffmpeg \
libjpeg-turbo-utils \
mediainfo \
poppler-utils \
perl-image-exiftool \
curl \
bash \
;\
update-ca-certificates
# Copy PHP extensions from builder
COPY --from=builder /usr/local/lib/php/extensions /usr/local/lib/php/extensions
COPY --from=builder $PHP_INI_DIR/conf.d/docker-php-ext-* $PHP_INI_DIR/conf.d/
# Copying local files
COPY imagemagick-policy.xml /etc/ImageMagick-6/policy.xml
COPY docker-php-entrypoint /usr/local/bin/
# Configuring PHP and setting locale
RUN set -eux ;\
echo "memory_limit=300M" > "$PHP_INI_DIR/conf.d/memory-limit.ini" ;\
echo "date.timezone=${PHP_TIMEZONE:-Europe/Moscow}" > "$PHP_INI_DIR/conf.d/date_timezone.ini" ;\
echo "upload_max_filesize=500M" > "$PHP_INI_DIR/conf.d/custom_settings.ini" ;\
echo "post_max_size=500M" >> "$PHP_INI_DIR/conf.d/custom_settings.ini" ;\
echo "max_input_vars=10000" >> "$PHP_INI_DIR/conf.d/custom_settings.ini" ;\
rm -f $PHP_INI_DIR/php-fpm.d/zz-docker.conf ;\
ln -fs /usr/share/zoneinfo/"${PHP_TIMEZONE:-Europe/Moscow}" /etc/localtime
ENV LANG='en_US.UTF-8' \
LANGUAGE='en_US.UTF-8' \
LC_ALL='en_US.UTF-8'
WORKDIR /app
I also tried to use translit-0.7.1
version but was getting the same error.
wget https://pecl.php.net/get/translit-0.6.3.tgz --no-check-certificate
tar tvf translit-0.6.3.tgz|grep tests -c
0
pecl page lists 0.6.2
but it's 404:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.