Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
This is blocker to run a lot of tests without deprecation warnings
Steps to reproduce
$v=NULL;var_dump(strpos($v, 's'));
Run \Drupal\Tests\contact\Kernel\MessageEntityTest
vendor/bin/phpunit -c core/phpunit.xml.dist --colors=always --debug -v \
core/modules/contact/tests/src/Kernel/MessageEntityTest.php
PHPUnit 8.5.21 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.0RC3
Configuration: /var/www/html/web/core/phpunit.xml.dist
Testing Drupal\Tests\contact\Kernel\MessageEntityTest
Test 'Drupal\Tests\contact\Kernel\MessageEntityTest::testMessageMethods' started
Test 'Drupal\Tests\contact\Kernel\MessageEntityTest::testMessageMethods' ended
Time: 1.73 seconds, Memory: 6.00 MB
OK (1 test, 25 assertions)
Unsilenced deprecation notices (1)
1x: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated
1x in MessageEntityTest::testMessageMethods from Drupal\Tests\contact\Kernel
Proposed resolution
Use empty string instead of NULL for $namespace
and $autoload
Remaining tasks
review/commit
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3240191-2.patch | 955 bytes | andypost |
Comments
Comment #2
andypostComment #3
andypostadded example code to catch
Comment #4
alexpottThis is the same fix on the meta that makes lots of deprecations go away.
Comment #6
catchCommitted 2b279d3 and pushed to 9.3.x. Thanks!