Skip to content

Conversation

@Litarnus
Copy link
Contributor

While not actively requiring it, we still had polyfill available through symfony/options-resolver.

This PR removes the remaining polyfilled constructs and replaces them with PHP 7.2 compatible code.

@Litarnus Litarnus marked this pull request as ready for review September 24, 2025 07:18
@Litarnus Litarnus self-assigned this Sep 24, 2025
@Litarnus Litarnus changed the base branch from master to 5.x September 24, 2025 08:42
cursor[bot]

This comment was marked as outdated.

@Litarnus Litarnus merged commit 6eb4c3f into 5.x Sep 25, 2025
38 checks passed
@Litarnus Litarnus deleted the martinl/remove-polifill branch September 25, 2025 14:37
@glensc
Copy link
Contributor

glensc commented Oct 20, 2025

Seems counterproductive to stop using newer PHP functions.

What you want to do is to use "replace" in composer.json if you're annoyed by the polyfills or worried about disk space:

    "replace": {  
        "symfony/polyfill-ctype": "*",  
        "ralouphie/getallheaders": "*",  
        "symfony/polyfill-mbstring": "*",  
    }

@Litarnus
Copy link
Contributor Author

@glensc could you elaborate why you find it counterproductive?

I personally don't see harm in replacing them with old PHP version equivalents. We don't have to pull in additional dependencies while still maintaining compatibility with PHP 7.2.

Replace is not an option because we support PHP 7.2 and as far as I understand, using replace asserts that the system provides those functions, which is not something we can guarantee.

@glensc
Copy link
Contributor

glensc commented Oct 22, 2025

I don't see harm in using the polyfills; they are created to allow newer language functions. And if you want to use native functions, you can use "replace" to remove them from your vendor tree.

The "replace" is not something the library should do; it's rather for each project (application).

The bright side of the polyfills is that if you bump the required php version, you can just drop the polyfill from dependencies, no code changes are needed.

I feel maintaining your own copy of some function is something you should not do. the copied function will not receive any security or bug fixes. probably nobody will even analyze it, comparing it being in polyfill library or language engine itself

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants