Make WordPress Core

Opened 6 years ago

Last modified 9 months ago

#48086 new task (blessed)

Add required extensions and libraries to composer.json

Reported by: dingo_d's profile dingo_d Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.2.3
Component: Build/Test Tools Keywords: has-patch
Focuses: docs, coding-standards Cc:

Description

Composer offers a way to require or suggest certain platform packages: https://getcomposer.org/doc/01-basic-usage.md#platform-packages
Ticket 48081 addresses the PHP version, and this one covers the required libraries and extensions.

I've used the WP-CLI ext package (https://github.com/johnbillion/ext) to generate all the required and suggested extensions and libraries.

Attachments (2)

48086.diff (4.0 KB) - added by dingo_d 6 years ago.
48086.1.diff (1.2 KB) - added by dingo_d 6 years ago.
Updated the patch to only include the composer.json

Download all attachments as: .zip

Change History (19)

@dingo_d
6 years ago

#1 @jrf
6 years ago

Hi @dingo_d Yet another great step towards the future!

I've reviewed your patch and have two remarks:

  1. Please undo the update to the PHP_CodeSniffer package in the composer.lock file. There is an issue with a particular sniff which is why this update hadn't been done yet - see #47632 for more details.
  2. IIRC adding the lib-... requirements is only useful when you actually add versions to them. Otherwise, set the ext-... with * instead (for those extensions which are not part of the PHP core).

#2 @dingo_d
6 years ago

IIRC adding the lib-... requirements is only useful when you actually add versions to them. Otherwise, set the ext-... with * instead (for those extensions which are not part of the PHP core).

So I should just put those libraries to ext- and use wildcard, or remove them entirely (they seem to be required)? Not sure if there will be any negative impact for that.

Also, I'll exclude the lock update, but I'm unsure if this will cause any failures because composer validate complains about them not being up to date with the changes.

@dingo_d
6 years ago

Updated the patch to only include the composer.json

#3 @johnbillion
6 years ago

Related discussion on roots/wordpress: https://github.com/roots/wordpress/issues/12

#4 @jrf
6 years ago

Also, I'll exclude the lock update, but I'm unsure if this will cause any failures because composer validate complains about them not being up to date with the changes.

I think you do need to include an updated composer.lock with this change. Just run composer update --lock to only update the hash and not update dependencies.

So I should just put those libraries to ext- and use wildcard, or remove them entirely (they seem to be required)? Not sure if there will be any negative impact for that.

Yes. If they are extensions which are part of the PHP core which cannot be disabled and PHP cannot be explicitly compiled without them, leaving them out is fine.

Note: I have not checked the extensions listed. It looks very long to me - definitely compared to what's in Site Health.

#6 @jrf
6 years ago

Related ticket to update the list in Site Health: #47454

#7 @dingo_d
6 years ago

Ok, so for now, the best course of action is to get a confirmed list of required and recommended list of extensions needed. I also like the descriptions in this patch: https://core.trac.wordpress.org/attachment/ticket/23912/23912.6.patch, this could be used (with appropriate props ofc) for the suggested extensions.

And the handbook (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions) should be updated as well?

#8 @jrf
6 years ago

@dingo_d IMO, yes to both and the updated list of required and recommended extensions should also be used in #47454.

Maybe @rarst would also be so kind as to run his expert eye over this patch ?

#9 @Rarst
6 years ago

As of current patch, the list is way too wide. Many of PHP extensions used by WP core are optional, you can't rely on automated search to enumerate which of them are actually required. I did a manual pass years ago https://wordpress.stackexchange.com/a/42212/847

Also while technically being "extensions" some of these are de facto part of PHP core (e.g. date) and are redundant to require explicitly.

Last edited 6 years ago by Rarst (previous) (diff)

#10 @dingo_d
6 years ago

In your opinion @Rarst what would be the best way to handle the list? Remove the ones that come bundled with PHP, and the ones that are not required just push to suggested part of the composer.json?

#11 @Rarst
6 years ago

Since the scope of this composer.json is test environment really I would:

  1. omit anything that is part of PHP core, that's just not necessary
  2. limit require to the extensions that are hard requirement for tests to run/complete
  3. limit suggest to the extensions that are optionally covered by tests (if any)

#12 follow-up: @swissspidy
14 months ago

Since [56687] there is now ext-dom in the suggest list.

#13 in reply to: ↑ 12 @westonruter
14 months ago

  • Keywords 2nd-opinion removed
  • Milestone changed from Awaiting Review to 6.5

The scope here is beyond just the test environment. The JSON extension is required for frontend requests (e.g. theme.json and Interactivity API). So ext-json should be added to require.

#14 @swissspidy
14 months ago

  • Type changed from enhancement to task (blessed)

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


13 months ago

#16 @swissspidy
13 months ago

  • Milestone changed from 6.5 to 6.6

#17 @desrosj
9 months ago

  • Milestone changed from 6.6 to Future Release

While this is a task, there's been no meaningful movement this release cycle. I'm going to punt to Future Release. If someone decides they are willing and able to own this one during a numbered cycle, it can be moved back.

Note: See TracTickets for help on using tickets.