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

Some phing tasks require the Intl extension but the dependency is not declared #1840

Closed
iambrianreich opened this issue Jun 12, 2024 · 6 comments
Milestone

Comments

@iambrianreich
Copy link

Describe the bug

See the following image.

Basically, some phing tasks seem to require that intl be enabled, but it is not declared in composer.json. So you can install phing without having the extension compiled in/installed/enabled, and then get runtime failures if you use built-in tasks that depend on it.

I encountered this issue because we noticed we had php-intl installed on our servers though our application doesn't depend on it. So I disabled the extension on my development machine, and confirmed that our application still works and passes all the tests. But then when I went to do a build using phing, the build failed due to the missing dependency. So I cleared my vendor directory and did a fresh composer install to see if phing would install without php-intl being enabled, the install succeeded, and phing builds continued to fail unless I re-enable php-intl.

Steps To Reproduce

  1. Disable the intl extension in PHP. Depending on your OS/PHP setup, your steps may vary. For me, I renamed /usr/local/etc/php/ext-20-intl.ini to ext-20-intl.ini.disabled
  2. Create a phing build.xml that uses the <tstamp> task, which requires the extension
  3. Confirm that build fails.

Expected behavior

  1. Build fails with error TstampTask requires Intl extension

Screenshots / terminal output

image

@jawira
Copy link
Contributor

jawira commented Jun 12, 2024

Hello, not a bug, it's like that by design.

This way people not using TstampTask are not forced to install Intl extension in vain.
There are other Tasks that have the same behaviour.

I kindly suggest to add Intl extension as a dev dependency (require-dev section) in your own project:

$ composer require ext-intl:* --dev

@brianreichtcs
Copy link

Hello, not a bug, it's like that by design.

This way people not using TstampTask are not forced to install Intl extension in vain. There are other Tasks that have the same behaviour.

I kindly suggest to add Intl extension as a dev dependency (require-dev section) in your own project:

$ composer require ext-intl:* --dev

I guess that makes sense given phing's current structure. If tasks not everyone uses were separate/optional dependencies maybe they'd declare their own requirements, but that isn't the structure today.

Thanks so much for the quick response. I'll do as you suggested in my own project.

@mrook
Copy link
Member

mrook commented Sep 4, 2024

We can add it to the suggest section.

@mrook mrook added this to the 3.0.1 milestone Sep 4, 2024
@mrook mrook closed this as completed in 418821c Sep 4, 2024
@brianreichtcs
Copy link

Thank you!

@pmalay
Copy link

pmalay commented Nov 13, 2024

Is it possible to add intl dependency if we are using docker image phing/phing:3.0.0 or even nightly?

@mrook
Copy link
Member

mrook commented Nov 14, 2024

Good idea. Continuing in #1875.

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

No branches or pull requests

5 participants