Skip to content

Commit 4b22781

Browse files
committed
uuid: avoid PHP warnings in GlobalIdGenerator::load()
Make sure that preg_match() is not passed false instead of a string Change-Id: I9571010f23afcfce4b42e14d29707879b3c556d1
1 parent a0115a7 commit 4b22781

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

includes/libs/uuid/GlobalIdGenerator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,8 @@ private function load() {
657657

658658
$this->loaded = true;
659659

660-
$nodeId = '';
661-
if ( is_file( $this->nodeIdFile ) ) {
662-
$nodeId = file_get_contents( $this->nodeIdFile );
663-
}
660+
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
661+
$nodeId = @file_get_contents( $this->nodeIdFile ) ?: '';
664662
// Try to get some ID that uniquely identifies this machine (RFC 4122)...
665663
if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
666664
AtEase::suppressWarnings();

0 commit comments

Comments
 (0)