Skip to content

Commit a0fa223

Browse files
author
Paul Bearne
committed
Ensure empty marker lines are excluded in src/wp-admin/includes/misc.php
1 parent a701ef5 commit a0fa223

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/wp-admin/includes/misc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ function extract_from_markers( $filename, $marker ) {
8686
continue;
8787
}
8888

89-
$result[] = $markerline;
89+
if ( '' !== $markerline ) {
90+
$result[] = $markerline;
91+
}
9092
}
9193

9294
if ( str_contains( $markerline, '# BEGIN ' . $marker ) ) {

tests/phpunit/tests/admin/includes/misc/extractFromMarkers.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,17 @@ public function test_extract_from_markers( $expected, $content, $marker ) {
4444
$this->assertSame( $expected, extract_from_markers( $this->temp_file, $marker ) );
4545
}
4646

47-
/**
48-
* Data provider for test_extract_from_markers.
49-
*
50-
* @return array[]
51-
*/
47+
/**
48+
* Data provider for test_extract_from_markers.
49+
*
50+
* @return array[]
51+
*
52+
* @phpstan-return array<string, array{
53+
* expected: string[],
54+
* content: string,
55+
* marker: string,
56+
* }>
57+
*/
5258
public function data_extract_from_markers() {
5359
return array(
5460
'Empty file' => array(

0 commit comments

Comments
 (0)