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

1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i is not recognized (the address from the examples at the repo home page) #7

Closed
meglio opened this issue Jul 11, 2023 · 10 comments · Fixed by #9

Comments

@meglio
Copy link

meglio commented Jul 11, 2023

When running this in Docker Container, PHP 8.1.19:

$validator = new AddressValidator();
$validator->isValid('1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i');

It returns FALSE.

Any ideas?

@kielabokkie
Copy link
Owner

That's strange, it should work fine on 8.1 as the tests are also run against it.

Is it just that address or do they all fail? Can you maybe provide a docker file so I can replicate the issue?

@meglio
Copy link
Author

meglio commented Aug 7, 2023

A docker file for two lines of code?

@kielabokkie
Copy link
Owner

It was more to see what kind of base image you use and what extensions you have installed etc.

It works fine on Docker locally for me. The Github Actions also run on docker and pass. You are asking for help so the least you can do it provide me with something to replicate your issue. Let me know if that's too much work so I can close the issue.

@meglio
Copy link
Author

meglio commented Aug 24, 2023

Hi @kielabokkie . I'm not asking for help indeed, I have solved the problem for my project long time ago by using other libraries, importing functions etc.

I was just trying to be helpful by bringing your attention to the issue.

@kielabokkie
Copy link
Owner

@meglio I appreciate you are trying to bring my attention to an issue but if I can't replicate the issue it's hard to try and solve it don't you think? From the sound of it, it could be an issue with a missing PHP extension on the Docker container you are using but if you can't share it then I can't do anything to try and investigate further.

As you are unwilling to help me replicate the issue and are using another library, I will close this issue now.

@meglio
Copy link
Author

meglio commented Sep 4, 2023

Hi @kielabokkie,

Docker container:

FROM php:8.1.21-fpm

RUN apt-get update && apt-get install -y \
    procps supervisor \
    nano wget zip unzip gnupg libgpgme-dev \
    libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
    lsb-release htop qrencode \
    && apt-get install -y --no-install-recommends libpq-dev libgmp-dev

# The following are needed in dev profile only.
RUN apt-get update && apt-get install -y \
    iputils-ping

RUN docker-php-ext-install pgsql

# RUN docker-php-ext-install pgsql gnupg

# -f, --force - will overwrite newer installed packages
RUN pecl install -f xdebug-3.1.5 && docker-php-ext-enable xdebug
RUN pecl install -f gnupg-1.5.1 && docker-php-ext-enable gnupg

RUN docker-php-ext-install pcntl sysvmsg sysvsem gmp

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd

# Install postgresql-client so that we can call pg_dump from within the container
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get update && apt-get -y install postgresql-client

### NODE
# Install node. Source: https://github.com/nodesource/distributions#deb
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
# Install global node packages needed for jstools/*
RUN npm install -g [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
# Create a folder where javascript tools will be placed
RUN mkdir -p /jstools
# Create a node_modules symlink to the global node modules folder, so that the caller can run js and mjs files
RUN ln -s $(npm root -g) /jstools/node_modules
### END NODE

RUN echo 'alias xdebugon='\''export XDEBUG_CONFIG="start_with_request=yes mode=debug" XDEBUG_MODE=debug XDEBUG_SESSION=1'\''' >> ~/.bashrc
RUN echo 'alias xdebugoff='\''export XDEBUG_CONFIG="start_with_request=no mode=off" XDEBUG_MODE=off XDEBUG_SESSION=""'\''' >> ~/.bashrc
RUN echo 'alias xdebugprofile='\''export XDEBUG_CONFIG="start_with_request=0" XDEBUG_MODE=profile'\''' >> ~/.bashrc

# Use the default development configuration
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"


EXPOSE 9555
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

PHP INI file 1: shared.php.ini

# PHP configuration shared between all environments.

# Don't create the X-Powered-By header
expose_php = Off

max_input_vars = 3000
date.timezone = UTC
upload_max_filesize = 20M
max_post_size = 22MB
memory_limit = 300M

PHP INI file 2: dev.php.ini

# PHP configuration specific to development environment.

display_errors=On
display_startup_errors=On

[xdebug]
# Source: https://stackoverflow.com/a/38267548/335304

# ... off,develop,coverage,debug,gcstats,profile,trace
xdebug.mode=debug
xdebug.start_with_request=default
xdebug.discover_client_host=1
xdebug.idekey=PHPIDE
xdebug.client_host=host.docker.internal
xdebug.client_port=9005
xdebug.output_dir=/cache/xdebug
xdebug.var_display_max_children = 999
xdebug.var_display_max_data = 999
xdebug.var_display_max_depth = 100

composer.json

{
    "name": "xxx/yyy",
    "description": "Test",
    "type": "project",
    "readme": "README.md",
    "license": "proprietary",
    "config": {
        "vendor-dir": "src/php/vendor"
    },
    "autoload": {
        "psr-4": {
            "Bot\\": "src/php/"
        }
    },
    "require": {
        "php": "^8.1",
        "ext-gd": "*",
        "ext-pgsql": "*",
        "ext-curl": "*",
        "ext-sysvsem": "*",
        "ext-pcntl": "*",
        "ext-sysvmsg": "*",
        "ext-posix": "*",
        "ext-mbstring": "*",
        "ext-gmp": "*",
        "ext-gnupg": "*",
        "ext-ctype": "*",
        "ext-fileinfo": "*",
        "ext-readline": "*",
        "ext-sodium": "*",
        "imagine/imagine": "^1.3.3",
        "phpseclib/phpseclib": "3.0.19",
        "fakerphp/faker": "1.21.0",
        "ezyang/htmlpurifier": "^4.16",
        "hidehalo/nanoid-php": "^1.1",
        "nette/php-generator": "^4.0",
        "rinvex/countries": "^9.0"
    }
}

Any chance you could look at it with using these files?

@kielabokkie
Copy link
Owner

Thanks for providing these @meglio. I'll have a play around and let you know what I can find out.

@kielabokkie kielabokkie reopened this Sep 6, 2023
@kielabokkie
Copy link
Owner

kielabokkie commented Sep 16, 2023

@meglio I just tested it with the config you provided and it's only one small change to make it work.

In your Dockerfile on the line where you have RUN docker-php-ext-install pcntl sysvmsg sysvsem gmp you have to add bcmath, i.e. RUN docker-php-ext-install pcntl sysvmsg sysvsem gmp bcmath.

Let me know if that fixes the problem for you.

@meglio
Copy link
Author

meglio commented Sep 26, 2023

Thanks for getting back to me. Hm that's interesting, the fact that it fails quietely and gives wrong answer is not good. Any way to make it fail with an exception instead of giving an incorrect answer?

@kielabokkie
Copy link
Owner

@meglio This has been added in v2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants