Problem/Motivation
please see the link: https://php.watch/versions/8.1/internal-func-non-nullable-null-deprecation.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | metatag-n3261505-10.patch | 1.87 KB | damienmckenna |
| #9 | metatag-n3261505-9.patch | 1.55 KB | damienmckenna |
| #9 | metatag-n3261505-9.interdiff.txt | 1.05 KB | damienmckenna |
| #6 | metatag-php81-explode-null-6.patch | 1.39 KB | eugene bocharov |
| #2 | explode-php8.1-3261505-2.patch | 5.96 KB | sergiu stici |
Comments
Comment #2
sergiu stici commentedplease review the patch.
Comment #3
damienmckennaThanks for reporting the bug and providing a patch. Let's see what the testbot says.
Comment #4
eugene bocharov commentedThanks @Sergiu Stici for working on this.
As I can see, test errors are caused by page_manager module, which also requires edits to be PHP 8.1 compatible. So, this is outside metatag module.
I just recon, not all occurences of explode() parameters should be escaped but only those where we really can expect NULL value.
For exapmle
$default_type can not be NULL as it's checked before
Or here
$name can not be null as this is an array key and according to PHP manual Null will be cast to the empty string, i.e. the key null will actually be stored under "".
So I think it would be better to look at each case of explode() individially.
Comment #5
damienmckennaLet's get this into the next release, it's blocking progress in other issues.
Comment #6
eugene bocharov commentedI've looked at all explodes in the module and acutally I see only one place where we can expect NULL as argument. This is where the tests fail \Drupal\metatag\Form\MetatagDefaultsForm::form line 161. Instead of just using
??I suggest enclose a couple lines inifto not perform redundant operations if metatag id is not defined yet.The patch is attached.
I still expect one test failure because of page_manager_ui module.
Comment #8
eugene bocharov commentedAs expected. The source of remaining error is on the page_manager_ui module side.
Comment #9
damienmckennaThanks! Let's simplify the logic a little.
Comment #10
damienmckennaComment #11
damienmckennaI opened #3263077: PHP 8.1 compatibility fixes for Page Manager for the Page Manager problem.
Comment #13
damienmckennaLet's move the Page Manager tests out of the way, for now.
Comment #15
eugene bocharov commentedI don't know what does it mean, but I had no errors testing locally, so ran retest and now the testbot shows no errors as well.
Comment #17
damienmckennaI've committed #13 and opened #3263140: Reenable Metatag Page Manager tests when it works with PHP 8.1 for dealing with Page Manager. Thank you all for collaborating on this!
Comment #18
damienmckenna