tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 96 forks source link

[BUG] Undefined constant Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL #530

Closed vertigone closed 10 months ago

vertigone commented 11 months ago

Hello

Describe the bug I upgraded docker image kimai/kimai2:fpm-1.0.31-prod to kimai/kimai2:fpm-2.0.26-prod after restart i have the following error:

NOTICE: PHP message: PHP Fatal error: Uncaught Error: Undefined constant Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL in /opt/kimai/public/index.php:23

To Reproduce

Upgrade docker image and use following commands:

docker run --rm -ti -v kimai_public:/public --entrypoint /bin/bash kimai/kimai2 bash-5.0$ cp -r /opt/kimai/public / bash-5.0$ exit me@myhost $ me@myhost $ docker-compose exec kimai /opt/kimai/bin/console assets:install

full log in attachment

Desktop (please complete the following information):

Docker compose file (with passwords redacted)

version: '3.5'
services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=******
      - MYSQL_ROOT_PASSWORD=*******
    volumes:
      - mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3
    networks:
      -  kimai-tier

  nginx:
    logging:
      driver: journald
      options:
        tag: "{{.Name}}"
    image: tobybatch/nginx-fpm-reverse-proxy
    #ports:
    #  - 8001:80
    volumes:
      - public:/opt/kimai/public:ro
    restart: unless-stopped
    depends_on:
      - kimai
    networks:
      -  reverse-proxy_reverse-proxy
      -  kimai-tier

  kimai: # This is the latest FPM image of kimai
    logging:
      driver: journald
      options:
        tag: "{{.Name}}"
    image: kimai/kimai2:fpm-2.0.26-prod
    environment:
      - ADMINMAIL=*******
      - ADMINPASS=******
      - DATABASE_URL=mysql://kimaiuser:******@sqldb/kimai
      - TRUSTED_HOSTS=nginx,localhost,127.0.0.1,******,****.eu,*****.eu
    volumes:
      - public:/opt/kimai/public
    restart: unless-stopped

    networks:
      -  kimai-tier

Additional context Full upgrade log attached

thanks

docker log.txt

kevinpapst commented 10 months ago

Your code is not updated:

NOTICE: PHP message: PHP Fatal error: Uncaught Error: Undefined constant Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL in /opt/kimai/public/index.php:23

points to /opt/kimai/public/index.php:23

which is not existing, see https://github.com/kimai/kimai/blob/main/public/index.php