Problem/Motivation
This issue to collect all todos and updates discovered while making core compatible with PHP 8.0 in #3109885: [meta] Ensure compatibility of Drupal 9 with PHP 8.0 (as it evolves). Issues should be limited to removing dead code, unneeded compatibility layers, etc. that are already present in HEAD.
Add upcoming clean-ups and related issues.
Adopting new language features of PHP 8.0 or 8.1 (like union types, protected property promotion, etc.), is not in scope and should be targeted for 10.1.x instead.
Steps to reproduce
Proposed resolution
Remaining issues
- #3178994: Allow fatal error on PHP 8.0 in LocalStream::stream_open() for fopen()
- #3310307: GDToolkit::save() fails for some custom-local stream wrappers
Comments
Comment #2
andypost#3178998: Update error types and messages for PHP 8 will need to clean-up added conditions
Comment #3
andypostThere's shim added in #2736777: MySQL on PHP 8 now errors when committing or rolling back when there is no active transaction
Comment #4
andypostComment #5
gábor hojtsyParenting to Drupal 10 beta1 issue.
Comment #6
aaronmchaleUnion types are (will be?) a thing in PHP 8:
https://wiki.php.net/rfc/union_types_v2
Maybe this is a good opportunity to go through and add complete return types to most/all functions/methods?
Comment #7
andypostComment #8
aaronmchaleThanks Andy :)
Comment #9
gábor hojtsyI *think* this issue was meant to be a cleanup of backwards compatibility code that is left for PHP 7 support / forward compatibility with PHP 8. That is how it got into the Drupal 10 beta requirements.
Comment #10
andypostComment #11
gábor hojtsy#3252088: Increase Drupal::MINIMUM_PHP to 8.0.0 landed today.
(That does not in itself means that issues here should be pushed forward, depending on how much divergence should be in Drupal 9.4 vs. Drupal 10. Best to get release manager confirmation here.)
Comment #12
xjmNow that alpha1 is tagged and we're starting general deprecation removals, we can probably go ahead with this work as well.
Comment #13
xjmOh, re: #6, we would start adding union types and similar to 10.1.x at the earliest. Drupal 9.4 and Drupal 10 need to have the same public API, which means that public API needs to be compatible with PHP 7.3. Futhermore, adding typehints to existing code would need to be done with BC and deprecation.
Comment #14
xjmJust reiterating that work in this issue should be limited to removing dead code paths where older PHP versions are handled separately. PHPUnit often requires us to add such compatibility layers, for example.
Comment #15
xjmComment #16
longwaveAdded two child issues:
#2532228: Use RecursiveCallbackFilterIterator instead of the $acceptTests parameter forwarding - PHP 5.3!
#3001920: Investigate PHP 7.3 workarounds
The MySQL driver has some comments about PHP 7:
Not sure we have an issue for these.
Comment #17
roderikI believe #3310307: GDToolkit::save() fails for some custom-local stream wrappers fits the bill of "remove unneeded compatibility layers".
Though I'm not claiming it's a must-have for D10, because AFAICT it could have been removed for PHP7 / D9 already and apparently noone encounters this issue...
Comment #18
roderikComment #19
quietone commentedI came across #1210798: In PHP 5.4+, html_entity_decode() doesn't decode invalid numeric entities which lead me to discover there are checks for PHP v 5.4 in core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php and core/tests/Drupal/Tests/Component/Utility/XssTest.php.
I haven't made an issue to remove those checks (I am focusing on something else right now) but noting it here in the hopes I come back or someone else picks this up.
Comment #20
spokjeCreated #3321945: Remove PHP < 5.4.0 checks to deal with the PHP 5.4 checks as discovered by @quietone in the comment above me.
Comment #21
spokjeComment #22
andypostMerged #3265953: Deprecate resource mentions in GDToolkit method names
Comment #24
andypostUpdated summary with 2 remaining issues
- #3178994: Allow fatal error on PHP 8.0 in LocalStream::stream_open() for fopen()
- #3310307: GDToolkit::save() fails for some custom-local stream wrappers