Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Installing ext-intl without phpunit trigger deprecation notices #60562

Closed
@ktherage

Description

@ktherage

Symfony version(s) affected

7.3.0-RC1

Description

This problem had been observed on version 7.3.0-RC1 but seem to exists on 7.4 and since 6.3 (I didn't search further down this version).

It seem to be caused by the check of \extension_loaded('intl') AND \defined('PHPUNIT_COMPOSER_INSTALL') right here : https://github.com/symfony/symfony/blob/7.4/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L341

I don't think this is a wanted deprecation notice even though tests should be mandatory and so PHPUnit installed, but it could happened.

How to reproduce

  1. install PHP extension INTL.
  2. install a symfony without phpunit.

Possible Solution

Just check for \extension_loaded('intl') instead of \extension_loaded('intl') AND \defined('PHPUNIT_COMPOSER_INSTALL')

Additional Context

Dockerfile used.

FROM dunglas/frankenphp:1-php8.4.7 AS base

# Caddy configuration
COPY Caddyfile /etc/frankenphp/Caddyfile

# Creation of User
RUN \
    # Utilisez "adduser -D ${USER}" pour les distributions basées sur Alpine
    useradd ${USER}; \
    # Ajouter la capacité supplémentaire de se lier aux ports 80 et 443
    setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \
    # Donner l'accès en écriture à /data/caddy et /config/caddy
    chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy

# PHP Extensions
RUN install-php-extensions \
      pdo_sqlite \
      intl \
      opcache

WORKDIR /app

ENV APP_ENV=dev

# PHP configuration
RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini

# PHP dev Extensions
RUN install-php-extensions @composer

COPY --chown=appuser:appuser .. /app

USER ${USER}

composer.json used :

{
    "type": "foo",
    "license": "proprietary",
    "minimum-stability": "RC",
    "prefer-stable": true,
    "require": {
        "php": ">=8.4",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "ext-pdo_sqlite": "*",
        "doctrine/dbal": "^3",
        "doctrine/doctrine-bundle": "^2.14",
        "doctrine/doctrine-migrations-bundle": "^3.4",
        "doctrine/orm": "^3.3",
        "symfony/console": "7.3.*",
        "symfony/dotenv": "7.3.*",
        "symfony/expression-language": "7.3.*",
        "symfony/flex": "^2.7",
        "symfony/form": "7.3.*",
        "symfony/framework-bundle": "7.3.*",
        "symfony/monolog-bundle": "^3.10",
        "symfony/runtime": "7.3.*",
        "symfony/twig-bundle": "7.3.*",
        "symfony/yaml": "7.3.*",
        "twig/extra-bundle": "^3.0",
        "twig/twig": "^3.0"
    },
    "require-dev": {
        "symfony/debug-bundle": "7.3.*",
        "symfony/stopwatch": "7.3.*",
        "symfony/web-profiler-bundle": "7.3.*"
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "bump-after-update": true,
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*",
        "symfony/polyfill-php82": "*",
        "symfony/polyfill-php83": "*",
        "symfony/polyfill-php84": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "7.3.*"
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions