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
Using tempnam() in PHP7.1 can result in PHP warnings if it falls back to the system temporary directory. This is the case for some of our tests.
exception: [Notice] Line 651 of core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php:
tempnam(): file created in the system's temporary directorytempnam('temporary://', 'vi_') (Line: 651)
Drupal\config_translation\Tests\ConfigTranslationUiTest->testPluralConfigStringsSourceElements() (Line: 958)
Drupal\simpletest\TestBase->run(Array) (Line: 752)
simpletest_script_run_one_test('378', 'Drupal\config_translation\Tests\ConfigTranslationUiTest') (Line: 66)
See https://bugs.php.net/bug.php?id=69489
Proposed resolution
Don't use temporary://
as the stream wrapper is not defined.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#4 | 2842942-4.patch | 6.92 KB | alexpott |
#3 | 2842942-2.patch | 4.83 KB | alexpott |
Comments
Comment #2
alexpottComment #3
alexpottComment #4
alexpottMissed one and the problem is that
tempnam()
just does not support streams so all the calls are bogus - they're never going to end up in Drupal's temp directory. I've reviewed all thetempnam()
usage in core and after this patch it all looks good to me.Comment #5
catchLooks good. It's a straight 1 for 1 switch and 7.1 is indirectly providing test coverage for us now, even if it was silently failing before.
Comment #8
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!