Problem/Motivation

Since PHP 8.5 beta3 using NULL as array offset produce deprication warning

Symfony fixed it via https://github.com/symfony/symfony/pull/61662

Steps to reproduce

https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_nul...

    1 test triggered 1 PHP deprecation:
    
    1) /builds/issue/drupal-3523596/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php:24
    Using null as an array offset is deprecated, use an empty string instead
    
    Triggered by:
    
    * Drupal\Tests\views\Functional\Wizard\EntityTestRevisionTest::testRevisionsViewWithNoTypeOnBaseTable (28 times)
      /builds/issue/drupal-3523596/core/modules/views/tests/src/Functional/Wizard/EntityTestRevisionTest.php:28
    

Proposed resolution

Use ?? '' workaround to make tests green

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3546535

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andypost created an issue. See original summary.

andypost’s picture

Issue summary: View changes

andypost’s picture

Status: Active » Needs work

Added last commits from testing branch to simplify testing

andypost’s picture

in MR from Meta issue all tests aree fixed, new needs to backport all of fixes

catch made their first commit to this issue’s fork.

chi’s picture

Use ?? '' workaround to make tests green

Can we use array_key_exists instead of isset?

andypost’s picture

Issue tags: +Vienna2025

needs split into set of issues per component at least and debug each case

- Container could add typehint and remove broken tests
- NestaedArray needs to fix test and provide typehint
- Lazy collection needs to check for null and skip
- DiscoveryTrait.php should not allow null plugin

alexpott’s picture

alexpott’s picture

alexpott’s picture

alexpott’s picture

alexpott’s picture

Also need to do:
Drupal\Tests\Core\Entity\EntityUrlTest
Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest
Drupal\Tests\migrate\Unit\process\StaticMapTest

See https://drupal-gitlab-job-artifacts.s3.us-west-2.amazonaws.com/7b/7c/7b7...

alexpott’s picture

The StaticMapTest should be covered by the existing issue - #3458923: StaticMap documents that NULL is a supported map value but causes an error - maybe we can drop support for it... not sure.

Added:
#3555918: \Drupal\Core\Entity\EntityBase::toUrl() triggers deprecations on PHP 8.5
#3555935: \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest triggers deprecations on PHP. 8.5

I think that means all the issues from our unit tests on PHP 8.5 have issues.

mondrake’s picture

Title: Deal with NULL as array key/offset » [meta] Deal with NULL as array key/offset
Category: Task » Plan
andypost’s picture

the failure is caused by interface where NULL is expected array key and result

https://git.drupalcode.org/project/drupal/-/merge_requests/13219/diffs?c...

---- Drupal\Tests\layout_builder\FunctionalJavascript\BlockFilterTest ----
Status      Duration Info                                                                               
--------------------------------------------------------------------------------------------------------
Fail          5.639s testBlockFilter                                                                 
Failure       5.881s *** Process execution output ***                                                
    PHPUnit 11.5.42 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.5.0RC4
    Configuration: /builds/issue/drupal-3546535/core/phpunit.xml.dist
    
    F                                                                   1 / 1 (100%)
    
    HTML output was generated.
    http://localhost/subdirectory/sites/simpletest/browser_output/Drupal_Tests_layout_builder_FunctionalJavascript_BlockFilterTest-1-38229833.html
    http://localhost/subdirectory/sites/simpletest/browser_output/Drupal_Tests_layout_builder_FunctionalJavascript_BlockFilterTest-2-38229833.html
    
    
    Time: 00:05.755, Memory: 8.00 MB
    
    Block Filter (Drupal\Tests\layout_builder\FunctionalJavascript\BlockFilter)
     ✘ Block filter
       ┐
       ├ Failed asserting that actual size 3 matches expected size 2.
       │
       │ /builds/issue/drupal-3546535/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php:110
       ┴
    
    FAILURES!
    Tests: 1, Assertions: 16, Failures: 1.
alexpott’s picture

catch’s picture

Status: Needs work » Reviewed & tested by the community

I think all of these are in now.

andypost’s picture

Tests show that only 2 dependency releases left to fix and composer 2.9.1 compatibility #3557585: Update to Composer 2.9.2

Confirm RTBC/Fixed!

TL'DR #3523596-66: [meta] PHP 8.5 support

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Let's mark this as fixed as all the sub issues are and the tests are telling us this is so.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.