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

Polyfills are deprecated #141

Closed
M4SX5 opened this issue Sep 13, 2021 · 4 comments · Fixed by #145
Closed

Polyfills are deprecated #141

M4SX5 opened this issue Sep 13, 2021 · 4 comments · Fixed by #145

Comments

@M4SX5
Copy link

M4SX5 commented Sep 13, 2021

I successfully set up the qr bill for my application. Nevertheless, I always get the following error message:

Deprecated: Since symfony/intl 5.3: Polyfills are deprecated, try running "composer require symfony/polyfill-intl-icu ^1.21" instead.

Is there a possibility to upgrade the dependent libraries?

@sprain
Copy link
Owner

sprain commented Sep 14, 2021

What PHP version are you using?
Are there any other dependencies in your project?

@sprain sprain added the needs reproduction The issue cannot yet be reproduced reliably label Sep 15, 2021
@M4SX5
Copy link
Author

M4SX5 commented Sep 15, 2021

Hi Sprain
Thank you very much for your answer. I'm working with different versions of php 8 (currently 8.0.10). The deprecated warning occurs with on all versions. There are several other dependencies in my project. Below you find a list of the dependencies:

"payrexx/payrexx": "dev-master",
"phpmailer/phpmailer": "^6.1",
"components/jquery": "3.5.*",
"nikic/fast-route": "^1.3",
"components/jqueryui": "^1.12",
"jumbojett/openid-connect-php": "^0.9.1",
"tecnickcom/tcpdf": "^6.3",
"spatie/schema-org": "^3.3",
"guzzlehttp/guzzle": "^7.3",
"microsoft/azure-storage-blob": "^1.5",
"sendinblue/api-v3-sdk": "7.x.x",
"sprain/swiss-qr-bill": "^3.1"

Following the StackTrace of the error:

Exception: Fehlertyp konnte nicht analyisiert werden in /var/www/html/routers/Router.php:513 
Stack trace: 
#0 [internal function]: Ludonix\Routers\Router::handleErrors() 
#1 /var/www/html/vendor/symfony/deprecation-contracts/function.php(25): trigger_error() 
#2 /var/www/html/vendor/symfony/intl/Resources/stubs/Locale.php(16): trigger_deprecation() 
#3 /var/www/html/vendor/composer/ClassLoader.php(476): include('...') 
#4 /var/www/html/vendor/composer/ClassLoader.php(344): Composer\Autoload\includeFile() 
#5 /var/www/html/vendor/symfony/intl/Locale.php(21): Composer\Autoload\ClassLoader->loadClass() 
#6 /var/www/html/vendor/composer/ClassLoader.php(476): include('...') 
#7 /var/www/html/vendor/composer/ClassLoader.php(344): Composer\Autoload\includeFile() 
#8 /var/www/html/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php(142): Composer\Autoload\ClassLoader->loadClass() 
#9 /var/www/html/vendor/symfony/intl/ResourceBundle.php(54): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry() 
#10 /var/www/html/vendor/symfony/intl/Countries.php(68): Symfony\Component\Intl\ResourceBundle::readEntry() 
#11 /var/www/html/vendor/symfony/validator/Constraints/CountryValidator.php(46): Symfony\Component\Intl\Countries::exists() 
#12 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(759): Symfony\Component\Validator\Constraints\CountryValidator->validate() 
#13 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(602): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateInGroup() 
#14 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(516): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateGenericNode() 
#15 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(313): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateClassNode() 
#16 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(661): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateObject() 
#17 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(516): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateGenericNode() 
#18 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(313): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateClassNode() 
#19 /var/www/html/vendor/symfony/validator/Validator/RecursiveContextualValidator.php(138): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateObject() 
#20 /var/www/html/vendor/symfony/validator/Validator/RecursiveValidator.php(93): Symfony\Component\Validator\Validator\RecursiveContextualValidator->validate() 
#21 /var/www/html/vendor/sprain/swiss-qr-bill/src/Validator/SelfValidatableTrait.php(24): Symfony\Component\Validator\Validator\RecursiveValidator->validate() 
#22 /var/www/html/vendor/sprain/swiss-qr-bill/src/Validator/SelfValidatableTrait.php(29): Sprain\SwissQrBill\QrBill->getViolations() 
#23 /var/www/html/vendor/sprain/swiss-qr-bill/src/QrBill.php(167): Sprain\SwissQrBill\QrBill->isValid() 
#24 /var/www/html/vendor/sprain/swiss-qr-bill/src/PaymentPart/Output/AbstractOutput.php(167): Sprain\SwissQrBill\QrBill->getQrCode() 
#25 /var/www/html/vendor/sprain/swiss-qr-bill/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php(92): Sprain\SwissQrBill\PaymentPart\Output\AbstractOutput->getQrCode() 
#26 /var/www/html/vendor/sprain/swiss-qr-bill/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php(81): Sprain\SwissQrBill\PaymentPart\Output\TcPdfOutput\TcPdfOutput->addSwissQrCodeImage() 
#27 /var/www/html/components/AdvancedComponents/Dokumente/PDF.php(88): Sprain\SwissQrBill\PaymentPart\Output\TcPdfOutput\TcPdfOutput->getPaymentPart() 
#28 /var/www/html/components/AdvancedComponents/Dokumente/Rechnung.php(173): Ludonix\Components\AdvancedComponents\Dokumente\PDF->erstellePDF() 
#29 /var/www/html/controllers/Dokumente/Rechnung_Controller.php(205): Ludonix\Components\AdvancedComponents\Dokumente\Rechnung->create() 
#30 /var/www/html/controllers/Dokumente/Rechnung_Controller.php(67): Ludonix\Controllers\Dokumente\Rechnung_Controller->erstellePDF() 
#31 /var/www/html/controllers/LoggedOutController.php(55): Ludonix\Controllers\Dokumente\Rechnung_Controller->initialize()
#32 /var/www/html/routers/Router.php(487): Ludonix\Controllers\LoggedOutController->__construct() 
#33 [internal function]: Ludonix\Routers\Router::Ludonix\Routers\{closure}() 
#34 /var/www/html/routers/Router.php(73): call_user_func() 
#35 /var/www/html/index.php(62): Ludonix\Routers\Router::route() 
#36 {main}

@kohlerdominik
Copy link
Contributor

kohlerdominik commented Sep 21, 2021

Hi @M4SX5

Thanks for this report. From your stack trace it looks like that this deprecation warning is triggered indirectly in symfony/validator. But symfony/validator does require neither symfony/intl nor symfony/polyfill-intl-icu, looks like this is up to the library using validator-methods which depend on this libraries.

So it might be true that we should add symfony/polyfill-intl-icu as dependeny, as we rely on it by using the CountryValidator which depends on Symfony\Component\Intl\Countries::exists() which then utilizes its Symfony\Component\Intl\Locale. This extends \Locale, which if triggers it's own polyfill (the deprecated one) in case the php-intl extension is not installed.

TLDR:
If you just composer require symfony/polyfill-intl-icu ^1.21 in your project, the deprecation warning should disapear. Can you confirm this?

@M4SX5
Copy link
Author

M4SX5 commented Oct 4, 2021

Hi @kohlerdominik

Thank you for your answer. I just tried your suggestion and can confirm, that when I add polyfill-intl-icu as a dependency in my project (composer require symfony/polyfill-intl-icu ^1.21) the deprecation warning disapears.

@sprain sprain removed the needs reproduction The issue cannot yet be reproduced reliably label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants