Skip to content

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

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

Closed
ktherage opened this issue May 27, 2025 · 2 comments

Comments

@ktherage
Copy link
Contributor

ktherage commented May 27, 2025

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.*"
        }
    }
}
@xabbuh
Copy link
Member

xabbuh commented May 27, 2025

I am not sure I understand the report. The statement checks if the extension is NOT loaded. But you say that you have the extension so you shouldn't see the deprecation, right?

@ktherage
Copy link
Contributor Author

ktherage commented May 27, 2025

Forget about it, removing completly the var/cache via rm -rf had removed the deprecation notice.
I probably messed with up something.

Really sorry for that.

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

No branches or pull requests

3 participants