Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid intl extension built : Uncaught IntlException: Constructor failed #504

Closed
Canadadry opened this issue Jul 16, 2024 · 2 comments · Fixed by #505
Closed

Invalid intl extension built : Uncaught IntlException: Constructor failed #504

Canadadry opened this issue Jul 16, 2024 · 2 comments · Fixed by #505
Labels
bug Something isn't working kind/dependency Issues related to dependencies

Comments

@Canadadry
Copy link

Canadadry commented Jul 16, 2024

I tried to build a php cli version with intl but failed to used it
I can build php with intl extension but I can run this simple file

// inlt.php
<?php 

$fmt = new \NumberFormatter( locale_get_default(), \NumberFormatter::DECIMAL );
$result = $formatter->parse('100,01');
echo $result;

it throw an exception

> buildroot/bin/php intl.php 

Fatal error: Uncaught IntlException: Constructor failed in /Users/Canadadry/static-php-cli/intl.php:3
Stack trace:
#0 /Users/Canadadry/static-php-cli/intl.php(3): NumberFormatter->__construct('fr_FR', 1)
#1 {main}
  thrown in /Users/Canadadry/static-php-cli/intl.php on line 3

I am on a mac M1 any idea on what I missed ? Or what I should try, internet search suggest intl extension or icu library is not installed correctly.

Thank you for ready me.

Here a dockerfile to reproduce the error

FROM  php:8.3-cli

RUN apt-get update && \
    apt-get install -y curl git unzip build-essential automake autoconf bison gawk texinfo  && \
    apt-get clean

RUN git clone https://github.com/crazywhalecc/static-php-cli.git

WORKDIR /static-php-cli

RUN chmod +x bin/setup-runtime
RUN bin/setup-runtime
RUN bin/composer install
RUN chmod +x bin/spc
RUN bin/spc --version
RUN bin/spc download --with-php=8.3 --for-extensions "intl" --prefer-pre-built
RUN bin/spc doctor --auto-fix
RUN bin/spc build --build-cli "intl"

COPY intl.php intl.php

CMD ["buildroot/bin/php", "intl.php"]

just run

docker build -t static-php-cli .
 docker run static-php-cli
@crazywhalecc crazywhalecc added bug Something isn't working kind/extension Issues related to extensions kind/dependency Issues related to dependencies and removed kind/extension Issues related to extensions labels Jul 17, 2024
@crazywhalecc
Copy link
Owner

crazywhalecc commented Jul 18, 2024

Caused by icu4c 75.1 build (missing binary tools for icu). This issue will be fixed in the next release of static-php-cli.

@Canadadry
Copy link
Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kind/dependency Issues related to dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants