Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: URI Routing Placeholders #4421

Closed
obipascal opened this issue Mar 12, 2021 · 3 comments
Closed

Bug: URI Routing Placeholders #4421

obipascal opened this issue Mar 12, 2021 · 3 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@obipascal
Copy link

The URL Routing Placeholder does not capture the right values when defined
for example:
$routes->get("/(:hash)", "Home::index/$1");
where the url is
http://localhost/www/bitmoservice/public/#padoafa

Will not grape the hash fragment of the url and also the

$routes->get("/(:any)", "Home::index/$1");
where the url is
http://localhost/www/bitmoservice/public/path/to/resource

will not capture the: path/to/resource and return it as provided in the url.
`
** Expected Results **

  1. I was expecting to see the hash fragment passed to my controller and then i can retrieve it as argument.
  2. secondly i was expecting the (:any) placeholder to return the whole fragment of the the url including the slashes as provided so i can determined what the user was trying to access. In the previous version of the app release this methods where working properly and in CI version 3 too. Hope this will be identified and resolved soon.

CI Version 4.1.1

Affected module(s)
app\Config\Routes.php

Context

  • OS: [e.g. Windows 10 pro]
  • Web server [e.g. Apache 2.4.46]
  • PHP version [e.g. 7.4.59]
@obipascal obipascal added the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 12, 2021
@MGatner
Copy link
Member

MGatner commented Mar 13, 2021

(:hash) doesn't refer to the hashtag. I'm honestly not sure what that is supposed to do because it has the same placeholder regex as segment with no special handling:

	protected $placeholders = [
		'any'      => '.*',
		'segment'  => '[^/]+',
		'alphanum' => '[a-zA-Z0-9]+',
		'num'      => '[0-9]+',
		'alpha'    => '[a-zA-Z]+',
		'hash'     => '[^/]+',
	];

(:any) should indeed match "the rest of the URI" but my guess is that in your case it is failing because of the preceding slash with no other segment, but I'd have to look through the code to be sure. What do you get passed in as a parameter when it does match?

@MGatner
Copy link
Member

MGatner commented Mar 25, 2021

@obipascal Any updates?

@obipascal
Copy link
Author

obipascal commented Mar 28, 2021

Well i later used the (:any) and it worked well with the functionality i wanted to achieve.

@MGatner MGatner closed this as completed Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants