diff --git a/components/ILIAS/Data/src/URI.php b/components/ILIAS/Data/src/URI.php index a414c13612a3..bd4e9d0f9ec2 100755 --- a/components/ILIAS/Data/src/URI.php +++ b/components/ILIAS/Data/src/URI.php @@ -61,8 +61,7 @@ class URI private const UNRESERVED = self::ALPHA_DIGIT . '|[\\-\\._~]'; private const UNRESERVED_NO_DOT = self::ALPHA_DIGIT . '|[\\-_~]'; - private const PCHAR = self::UNRESERVED . '|' . self::SUBDELIMS . '|' . self::PCTENCODED . '|:|@'; - private const BASEURI_PCHAR = self::UNRESERVED . '|' . self::BASEURI_SUBDELIMS . '|' . self::PCTENCODED . '|:|@'; + private const PCHAR = self::UNRESERVED . '|' . self::SUBDELIMS . '|' . self::PCTENCODED; private const SCHEMA = '#^' . self::ALPHA . '(' . self::ALPHA_DIGIT . '|' . self::PIMP . ')*$#'; private const DOMAIN_LABEL = self::ALPHA_DIGIT . '((' . self::UNRESERVED_NO_DOT . '|' . self::PCTENCODED . '|' . self::BASEURI_SUBDELIMS . ')*' . self::ALPHA_DIGIT . ')*'; diff --git a/components/ILIAS/Data/tests/URITest.php b/components/ILIAS/Data/tests/URITest.php index cb017f6eb3da..55582055b88b 100755 --- a/components/ILIAS/Data/tests/URITest.php +++ b/components/ILIAS/Data/tests/URITest.php @@ -38,12 +38,12 @@ class URITest extends TestCase private const URI_NO_QUERY_1 = 'git://one-letter-top-level.a:8080/someaccount/somerepo/somerepo.git/#fragment'; private const URI_NO_QUERY_2 = 'git://github.com:8080/someaccount/somerepo/somerepo.git#fragment'; - private const URI_AUTHORITY_AND_QUERY_1 = 'git://github.com?query_p$,;:A!\'*+()ar_1=val_1&quer?y_par_2=val_2'; - private const URI_AUTHORITY_AND_QUERY_2 = 'git://github.com/?qu/ery_p$,;:A!\'*+()ar_1=val_1&quer?y_par_2=val_2'; + private const URI_AUTHORITY_AND_QUERY_1 = 'git://github.com?query_p$,;A!\'*+()ar_1=val_1&quer?y_par_2=val_2'; + private const URI_AUTHORITY_AND_QUERY_2 = 'git://github.com/?qu/ery_p$,;A!\'*+()ar_1=val_1&quer?y_par_2=val_2'; - private const URI_AUTHORITY_AND_FRAGMENT = 'git://github.com:8080/#fragment$,;:A!\'*+()ar_1=val_1&'; + private const URI_AUTHORITY_AND_FRAGMENT = 'git://github.com:8080/#fragment$,;A!\'*+()ar_1=val_1&'; - private const URI_AUTHORITY_PATH_FRAGMENT = 'git://git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git#frag:A!\'*+()arment'; + private const URI_AUTHORITY_PATH_FRAGMENT = 'git://git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git#fragA!\'*+()arment'; private const URI_PATH = 'git://git$,;hub.com:8080/someacc$,;ount/somerepo/somerepo.git/'; @@ -58,9 +58,10 @@ class URITest extends TestCase private const URI_WRONG_AUTHORITY_1 = 'git://git$,;huassertEquals('github.com', $uri->getHost()); $this->assertNull($uri->getPort()); $this->assertNull($uri->getPath()); - $this->assertEquals('query_p$,;:A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery()); + $this->assertEquals('query_p$,;A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery()); $this->assertNull($uri->getFragment()); $uri = new ILIAS\Data\URI(self::URI_AUTHORITY_AND_QUERY_2); @@ -259,7 +260,7 @@ public function test_authority_and_query(): void $this->assertEquals('github.com', $uri->getHost()); $this->assertNull($uri->getPort()); $this->assertNull($uri->getPath()); - $this->assertEquals('qu/ery_p$,;:A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery()); + $this->assertEquals('qu/ery_p$,;A!\'*+()ar_1=val_1&quer?y_par_2=val_2', $uri->getQuery()); $this->assertNull($uri->getFragment()); } @@ -273,7 +274,7 @@ public function test_authority_and_fragment(): void $this->assertEquals('8080', $uri->getPort()); $this->assertNull($uri->getPath()); $this->assertNull($uri->getQuery()); - $this->assertEquals('fragment$,;:A!\'*+()ar_1=val_1&', $uri->getFragment()); + $this->assertEquals('fragment$,;A!\'*+()ar_1=val_1&', $uri->getFragment()); } #[\PHPUnit\Framework\Attributes\Depends('test_init')] @@ -286,7 +287,7 @@ public function test_authority_path_fragment(): void $this->assertEquals('8080', $uri->getPort()); $this->assertEquals('someacc$,;ount/somerepo/somerepo.git', $uri->getPath()); $this->assertNull($uri->getQuery()); - $this->assertEquals('frag:A!\'*+()arment', $uri->getFragment()); + $this->assertEquals('fragA!\'*+()arment', $uri->getFragment()); } #[\PHPUnit\Framework\Attributes\Depends('test_init')] @@ -359,6 +360,13 @@ public function test_uri_invalid(): void new ILIAS\Data\URI(self::URI_INVALID); } + #[\PHPUnit\Framework\Attributes\Depends('test_init')] + public function test_invalid_characters_in_query(): void + { + $this->expectException(InvalidArgumentException::class); + new ILIAS\Data\URI(self::URI_INVALID_CHARACTERS_IN_QUERY); + } + #[\PHPUnit\Framework\Attributes\Depends('test_init')] public function test_realpctenc(): void { diff --git a/components/ILIAS/LegalDocuments/tests/Provide/ProvideDocumentTest.php b/components/ILIAS/LegalDocuments/tests/Provide/ProvideDocumentTest.php index 111dab703d9f..825f0079b6cc 100755 --- a/components/ILIAS/LegalDocuments/tests/Provide/ProvideDocumentTest.php +++ b/components/ILIAS/LegalDocuments/tests/Provide/ProvideDocumentTest.php @@ -72,7 +72,7 @@ public function testTableReadOnly(): void { $dummy_gui = new stdClass(); - $uri = 'http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'; + $uri = 'http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g.qo.gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'; $container = $this->mockTree(Container::class, [ 'ui' => [ @@ -97,7 +97,7 @@ public function testTableEditable(): void $dummy_gui = new stdClass(); - $uri = 'http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'; + $uri = 'http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g.qo.gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'; $container = $this->mockTree(Container::class, [ 'ui' => [ diff --git a/components/ILIAS/LegalDocuments/tests/Table/DocumentTableTest.php b/components/ILIAS/LegalDocuments/tests/Table/DocumentTableTest.php index cd4d04ab1e7c..adc6e3bf86f4 100755 --- a/components/ILIAS/LegalDocuments/tests/Table/DocumentTableTest.php +++ b/components/ILIAS/LegalDocuments/tests/Table/DocumentTableTest.php @@ -52,7 +52,7 @@ class DocumentTableTest extends TestCase public function testConstruct(): void { $uri = $this->mock(UriInterface::class); - $uri->method('__toString')->willReturn('http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'); + $uri->method('__toString')->willReturn('http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g.qo.gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'); $request = $this->mock(ServerRequestInterface::class); $request->method("getUri")->willReturn($uri); @@ -75,7 +75,7 @@ public function testConstruct(): void public function testCriterionName(): void { $uri = $this->mock(UriInterface::class); - $uri->method('__toString')->willReturn('http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'); + $uri->method('__toString')->willReturn('http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g.qo.gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50'); $request = $this->mock(ServerRequestInterface::class); $request->method("getUri")->willReturn($uri); diff --git a/components/ILIAS/UI/tests/Component/Link/BulkyLinkTest.php b/components/ILIAS/UI/tests/Component/Link/BulkyLinkTest.php index 7ed03a95ae14..2dfb24026e30 100755 --- a/components/ILIAS/UI/tests/Component/Link/BulkyLinkTest.php +++ b/components/ILIAS/UI/tests/Component/Link/BulkyLinkTest.php @@ -101,7 +101,7 @@ public function testGetAction(): void $with_query = $plain . "?query1=1"; $with_multi_query = $with_query . "&query2=2"; $with_fragment = $plain . "#fragment"; - $with_multi_query_and_fragment_uri = $with_multi_query . $with_fragment; + $with_multi_query_and_fragment_uri = $with_multi_query . "#fragment"; $plain_uri = new Data\URI($plain); $with_query_uri = new Data\URI($with_query);