Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#53334 closed task (blessed) (fixed)

Update Requests library to version 1.8.1

Reported by: jrf's profile jrf Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.8 Priority: normal
Severity: normal Version: 5.8
Component: External Libraries Keywords: has-patch
Focuses: Cc:

Description

The Requests library has released a new version: 1.8.1.

This is only a very minor update, with the most important change being that the version constant in the Requests class is now correct 🙄

Full changelog: https://github.com/WordPress/Requests/releases/tag/v1.8.1
Website (updated): https://requests.ryanmccue.info/

It is recommended for WordPress to update the bundled version of Requests.

Previous: #33055, #47746, #49922, #53101

Attachments (1)

53334.diff (212.3 KB) - added by kapilpaul 3 years ago.
Created patch.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.8

Moving to 5.8 as a follow-up to [50842] / #53101.

@kapilpaul
3 years ago

Created patch.

#2 @kapilpaul
3 years ago

  • Keywords has-patch added; needs-patch removed

#3 @SergeyBiryukov
3 years ago

Thanks for the patch!

Just noting that Requests/Transport/cacert.pem should not be included here, as WordPress has its own bundle of CA root certificates in wp-includes/certificates/ca-bundle.crt, loaded early in wp-includes/class-http.php.

#4 follow-up: @kapilpaul
3 years ago

@SergeyBiryukov

Thanks for the information. I will update the patch.

#5 @SergeyBiryukov
3 years ago

It also looks like this line should not be removed from Requests/Utility/FilteredIterator.php:

@phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore

Removing that causes the PHP compatibility task to fail:

Run phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr
Warning: Method name "Requests_Utility_FilteredIterator::__unserialize" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.
Error: Process completed with exit code 1.

This should probably be reported upstream. cc @jrf

#6 in reply to: ↑ 4 @SergeyBiryukov
3 years ago

So it looks like updating the VERSION constant would be the only change here, other fixes from 1.8.1 are all in the files not included in WordPress core.

Replying to kapilpaul:

Thanks for the information. I will update the patch.

Thanks! I think that would not be necessary though, I'll make the adjustments on commit :)

#7 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 51078:

External Libraries: Update the Requests library to version 1.8.1.

This is a minor update, with the most important change being that the version constant in the Requests class is now correct.

Release notes: https://github.com/WordPress/Requests/releases/tag/v1.8.1

For a full list of changes in this update, see the Requests GitHub:
https://github.com/WordPress/Requests/compare/v1.8.0...v1.8.1

Follow-up to [50842].

Props kapilpaul, jrf, schlessera, mbabker.
Fixes #53334.

#8 follow-up: @jrf
3 years ago

So it looks like updating the VERSION constant would be the only change here, other fixes from 1.8.1 are all in the files not included in WordPress core.

Sounds about right 😁

It also looks like this line should not be removed from Requests/Utility/FilteredIterator.php:

@phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore

Removing that causes the PHP compatibility task to fail:

Run phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr
Warning: Method name "Requests_Utility_FilteredIterator::__unserialize" is discouraged; PHP has > reserved all method names with a double underscore prefix for future use.
Error: Process completed with exit code 1.

This should probably be reported upstream. cc @jrf

@SergeyBiryukov I've looked into this. Both ignore annotations are correct based on the individual project environments.

Requests is already using PHPCS 3.6.0, while WP is still on PHPCS 3.5.5.

The PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames sniff uses a list maintained in PHPCS itself to determine which method names are "magic" and to exclude those from being reported by the sniff.

The method name __unserialize became a magic method in PHP 7.4.

The list with magic method names in PHPCS was updated for the PHP 7.4 change in PHPCS 3.5.6.
https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.5.6

Conclusion: once WP updates the locked PHPCS version, that particular annotation can be removed from the file in WP as well.

#9 in reply to: ↑ 8 @SergeyBiryukov
3 years ago

Replying to jrf:

Conclusion: once WP updates the locked PHPCS version, that particular annotation can be removed from the file in WP as well.

Ah, that makes sense now :) Thanks for looking into this and for the clarification!

Note: See TracTickets for help on using tickets.