vinkla / hashids

A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
https://hashids.org/php
MIT License
5.29k stars 417 forks source link

Github Actions produces gmp_mod(): Argument #1 ($num1) must be of type GMP|string|int error #200

Closed sts-ryan-holton closed 7 months ago

sts-ryan-holton commented 7 months ago

When running my Laravel test suite via Github Actions I get the following error:

gmp_mod(): Argument #1 ($num1) must be of type GMP|string|int, Illuminate\Support\Stringable given

Screenshot 2024-04-11 at 15 31 17

Also see my workflow file:

name: tests

on:
  pull_request:
  schedule:
    - cron: '0 0 * * *'

jobs:
  tests:
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: true
      matrix:
        php: [8.3]
        laravel: [11]
        exclude:
          - php: 8.3
            laravel: 11

    name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: dom, curl, libxml, mbstring, zip, bcmath
          ini-values: error_reporting=E_ALL
          tools: composer:v2
          coverage: none

      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.example', '.env');"

      - name: Install dependencies
        run: |
          composer install --prefer-dist --no-interaction --no-progress

      - name: Create SQLite database file
        run: |
          if [ ! -f database/database.sqlite ]; then
            touch database/database.sqlite
          fi

      - name: Run migrations
        run: php artisan migrate
        env:
          DB_CONNECTION: sqlite
          DB_DATABASE: database/database.sqlite

      - name: Execute tests
        run: vendor/bin/phpunit
        env:
          DB_CONNECTION: sqlite
          DB_DATABASE: database/database.sqlite

What am I missing? My test calls Hashids like: (new Hashids('', 7))->encode(rand(11111111, 99999999).''.rand(111111, 999999))

vinkla commented 7 months ago

For support, please use a forum instead of GitHub issues.