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

Reverse routing with Route::controller() #11

Closed
jasonlewis opened this issue Jan 12, 2013 · 7 comments
Closed

Reverse routing with Route::controller() #11

jasonlewis opened this issue Jan 12, 2013 · 7 comments

Comments

@jasonlewis
Copy link
Contributor

This may be intentional but I thought I'd bring it up just to double check.

If you use Route::controller() you can't use reverse routing for any of the actions on the controller. I believe this is because UrlGenerator::action() simply compares the _uses option of the route against the action provided. The requirements for a route aren't actually expanded.

A solution would be to convert the requirements into their regular expression equivalents and then compare the actions.

@taylorotwell
Copy link
Member

I have a note to look at this actually. I just need to have it use a conventional route setup when this happens. I don't really like route::controller :)

On Jan 11, 2013, at 6:49 PM, Jason Lewis [email protected] wrote:

This may be intentional but I thought I'd bring it up just to double check.

If you use Route::controller() you can't use reverse routing for any of the actions on the controller. I believe this is because UrlGenerator::action() simply compares the _uses option of the route against the action provided. The requirements for a route aren't actually expanded.

A solution would be to convert the requirements into their regular expression equivalents and then compare the actions.


Reply to this email directly or view it on GitHub.

@jasonlewis
Copy link
Contributor Author

I agree, but a lot of people do. I'm only asking because it was being talked about on IRC. I think a lot of people will be jumping at Route::controller() though because of how easy it is.

Cheers Taylor! :)

@taylorotwell
Copy link
Member

Yeah, I'm going to look at a solution this weekend as I have time.

@taylorotwell
Copy link
Member

I'm about halfway there on this one... :) put some stuff in last night that gets us closer, now I just need to modify how Route::controller works inside.

@johnnncodes
Copy link

Hi guys. I don't know if this is referring to the problem when using the the url to action helper. I already sent a tweet to @taylorotwell about the helper problem. When using Route::controller() , I can't use the helper action() to generate a url that points to the controller action in L4. In L3 it works. I hope it can be fixed since I really use that helper a lot (and many others I think).

@taylorotwell
Copy link
Member

This is done.

KluVerKamp added a commit to KluVerKamp/framework that referenced this issue Aug 29, 2015
Lately, I have upgraded my website from L 4.2.11 to the latest one. The Encryption cipher used before was MCRYPT_RIJNDAEL_128 which uses an IV with a length of 32. Since the payload in the cookies in users was encrypted using the old cipher, the EncryptCookies middleware threw an exception with this trace:

```
production.ERROR: exception 'ErrorException' with message 'openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating' in /home/www/MY/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:95
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'openssl_decrypt...', '/home/www/...', 95, Array)
laravel#1 /home/www/MY/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(95): openssl_decrypt('Dbyr0401XlXcY6N...', 'AES-256-CBC', 'VyZn2WxfW9UgMrI...', 0, 'h\x82\x9Co\t\x9Fqx\\\x84\x8B\x16\x8B\x82P...')
laravel#2 /home/www/MY/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(95): Illuminate\Encryption\Encrypter->decrypt('eyJpdiI6ImFJS2N...')
laravel#3 /home/www/MY/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(76): Illuminate\Cookie\Middleware\EncryptCookies->decryptCookie('eyJpdiI6ImFJS2N...')
laravel#4 /home/www/MY/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Cookie\Middleware\EncryptCookies->decrypt(Object(Illuminate\Http\Request))
laravel#5 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
laravel#6 /home/www/MY/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
laravel#7 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
laravel#8 /home/www/MY/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
laravel#9 /home/www/MY/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
laravel#10 /home/www/MY/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
laravel#11 /home/www/MY/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
laravel#12 {main} 
```
This commit will allow the the decrypt method to handle non `Illuminate\Contracts\Encryption\DecryptException` exceptions. Since sometimes that class can't cover all the decryption issues since cookies can be set from other third parties in the browser.
@sharadjaiswal1411
Copy link

taylorotwell pushed a commit that referenced this issue Feb 2, 2019
dbpolito pushed a commit to dbpolito/framework that referenced this issue Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants