Skip to content

Commit

Permalink
Allow "-" in version numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
gudmdharalds committed Dec 28, 2022
1 parent 9add4f0 commit e700490
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion output-security.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function vipgoci_output_sanitize_version_number(
string $version_number
) :string {
return preg_replace(
'/[^a-zA-Z0-9\.]/',
'/[^a-zA-Z0-9\.\-]/',
'',
$version_number
);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/OutputSecuritySanitizeVersionNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ protected function setUp() :void {
*/
public function testSanitizeVersionNumber(): void {
$sanitized_number = vipgoci_output_sanitize_version_number(
PHP_EOL . ' 1.50.30.3b, ' . "\t" . PHP_EOL
PHP_EOL . ' 1.50.30.3b, - 5b ' . "\t" . PHP_EOL
);

$this->assertSame(
'1.50.30.3b',
'1.50.30.3b-5b',
$sanitized_number
);
}
Expand Down

0 comments on commit e700490

Please sign in to comment.