Skip to content

Commit 1745096

Browse files
authored
Fix baseUri scheme related error (#2288)
Since (#1931) and PHP 8, an error occurs when raml2html extracts baseUri scheme. PHP Deprecated: mb_strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in tools/raml2html/vendor/raml-org/raml-php-parser/src/ApiDefinition.php on line 813
1 parent 3309727 commit 1745096

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tools/raml2html/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"raml-org/raml-php-parser": {
4343
"Array of scalars": "https://github.com/raml-org/raml-php-parser/commit/d2e58eac1705a8cf2be43ed3d482006e67e4ef2d.patch",
4444
"No available type list in type not found exception": "https://github.com/raml-org/raml-php-parser/commit/d54af98b9bd6d2400bbdd1c186e9b86c2dd88c83.patch",
45-
"Fix warnings and depreciations for PHP 8.1": "https://patch-diff.githubusercontent.com/raw/raml-org/raml-php-parser/pull/180.patch"
45+
"Fix warnings and depreciations for PHP 8.1": "https://patch-diff.githubusercontent.com/raw/raml-org/raml-php-parser/pull/180.patch",
46+
"Fix baseUri misuse": "patches/ApiDefinition.php.patch"
4647
}
4748
}
4849
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Index: tools/raml2html/vendor/raml-org/raml-php-parser/src/ApiDefinition.php
2+
IDEA additional info:
3+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
4+
<+>UTF-8
5+
===================================================================
6+
diff --git a/src/ApiDefinition.php b/src/ApiDefinition.php
7+
--- a/src/ApiDefinition.php
8+
+++ b/src/ApiDefinition.php (date 1707386266597)
9+
@@ -810,7 +810,7 @@
10+
11+
private function setProtocolsFromBaseUri(): void
12+
{
13+
- $schema = \mb_strtoupper(\parse_url($this->baseUri, PHP_URL_SCHEME));
14+
+ $schema = \mb_strtoupper(\parse_url($this->baseUri, PHP_URL_SCHEME) ?? '');
15+
16+
$this->protocols = empty($schema) ? [self::PROTOCOL_HTTPS, self::PROTOCOL_HTTP] : [$schema];
17+
}

0 commit comments

Comments
 (0)