[wp-trac] [WordPress Trac] #42264: Systematic way of dealing with compat code and polyfills

WordPress Trac noreply at wordpress.org
Wed May 23 09:39:57 UTC 2018


#42264: Systematic way of dealing with compat code and polyfills
----------------------------+------------------------------
 Reporter:  schlessera      |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Bootstrap/Load  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by schlessera):

 @jrf The intent of the ticket was not necessarily to provide a more
 granular way to load the backcompat code, as it was to make maintenance
 easier with regards to how we hopefully manage to more closely match the
 PHP update velocity in the long run.

 For extensions that are optional, you will always have to at least load
 the code that will check whether the extension is active and can be used.
 The check might even sometimes be complicated, as even extensions are not
 always compiled in the same way.

 For extensions that have become required at one point, you always load the
 polyfill except for when you've reached the minimum PHP version where it
 became standard.

 The setup I suggested basically makes it very easy to get rid of redundant
 code every time we bump the PHP minor version. So, when we bump PHP
 minimum version from PHP 5.2 to PHP 5.3 hopefully soon, we just delete the
 `/compat/php-5.2.php` file and that's it. PHP is moving faster and faster,
 and collecting a huge amount of compat code without a mechanism to get rid
 of it as needed, and without doubts about what to remove seems useful.

 I see no reason why we couldn't combine both approaches, to have PHP-
 version-based files and extension-based files.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42264#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list