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

Scoper build: Fatal Error due to Symfony polyfills redeclared functions #471

Closed
chriscollins405 opened this issue Jul 9, 2020 · 7 comments

Comments

@chriscollins405
Copy link

  • API Version: 2.18.0

Related to issue #462

Downloading and using the files without composer throws a fatal error due to the same functions being declared twice.

Rolling out across 2 servers, one on php 7.3 the other on 7.1

The 7.1 server uses the 7.2 polyfill, and this is where the redeclare issue happens.

WSOD, entire site down.

The only workaround I found was to open.....

/vendor/symfony/polyfill-php72/bootstrap.php

And comment out the following functions....

if (!\function_exists('mb_ord')) {
    // function mb_ord($s, $enc = null)
    // {
        // return \_PhpScoper5ed105407e8f2\Symfony\Polyfill\Php72\Php72::mb_ord($s, $enc);
    // }
}
if (!\function_exists('mb_chr')) {
    // function mb_chr($code, $enc = null)
    // {
        // return \_PhpScoper5ed105407e8f2\Symfony\Polyfill\Php72\Php72::mb_chr($code, $enc);
    // }
}
if (!\function_exists('mb_scrub')) {
    // function mb_scrub($s, $enc = null)
    // {
        // $enc = null === $enc ? \mb_internal_encoding() : $enc;
        // return \mb_convert_encoding($s, $enc, $enc);
    // }
}

The issue seems to be that the mollie php api files have both....

/vendor/symfony/polyfill-mbstring
/vendor/symfony/polyfill-php72

Both of these have a bootstrap.php file that declare mb_ord(), mb_chr() and mb_scrub()

The only fix right now is to either comment those functions out, or roll back to 2.17.0 of the API

This only seems to have been added since release 2.17.1 on the 18th May - the versions before that did not include a symfony directory.

Is this directory needed?

...

@sandervanhooft
Copy link
Collaborator

Oh my, that's unfortunate.

At first glance it seems like a collision between php-scoper dependencies.

Is it possible for you to use composer? Meanwhile I'll see if we can find another solution. Not sure where in the build process Scoper is being introduced tbh.

@chriscollins405
Copy link
Author

Thanks, no not possible to use composer for this project.

We will fall back to 2.17.0 of the mollie API as that seems stable at the moment. Just thought I'd highlight this incase anyone else runs into it.

@sandervanhooft
Copy link
Collaborator

Thanks for your understanding

@willemstuursma
Copy link
Contributor

Looks to be caused by guzzle/guzzle#2678, since then Guzzle can now work with very recent versions of Symfony IDN polyfill which brings in the other polyfills as well.

@willemstuursma
Copy link
Contributor

I think we could fix it by adding:

  "replace": {
    "symfony/polyfill-mbstring": "*",
    "symfony/polyfill-php72": "*"
  },

to composer.json .

However, composer does not have a command to add this replace in the Makefile.

@sandervanhooft sandervanhooft changed the title Fatal Error due to Symfony polyfills redeclared functions Scoper build: Fatal Error due to Symfony polyfills redeclared functions Jan 18, 2021
@sandervanhooft
Copy link
Collaborator

I've removed the Guzzle dependency in this alpha release, @chriscollins405 if you're still facing this issue, can you give it a try?

@sandervanhooft
Copy link
Collaborator

Closing this for now, let me know if it should be reopened.

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

No branches or pull requests

3 participants