CodeIgniter Forums
extention of autorouter in ci4.2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: extention of autorouter in ci4.2 (/showthread.php?tid=82722)



extention of autorouter in ci4.2 - dokitura - 08-15-2022

Hi.

I'm working on a CI4.1.9 application, which extends the default-handling of auto-routing (existing since CI3) more deeply.

Yesterday i've read about the problem, which comes with that handling concerning creating vulnerable apps where controller filters or CSRF protection are bypassed . On shorthand i decided to upgrade to CI4.2.3, but stumbled over these problems: So my questions would be:
  • is there any way, to extend new auto-routing handling (except writing a complete own handler for this)?
  • if not, is it maybe planned for a future ci-version, to establish the instantiation more dynamically like via service-method, etc.?
Thanks in advance.

(I'm willing to share more info, if you need anything ;-))

Greetings,
doki


RE: extention of autorouter in ci4.2 - kenjis - 08-16-2022

(08-15-2022, 09:34 AM)dokitura Wrote: is there any way, to extend new auto-routing handling (except writing a complete own handler for this)?

No. Final classes can not be extended.

Why do you want to extend it?
Writing a complete class is safer if the original class changes.

(08-15-2022, 09:34 AM)dokitura Wrote: if not, is it maybe planned for a future ci-version, to establish the instantiation more dynamically like via service-method, etc.?

Probably the routing handlers will be configurable in v5, but I don't know the existing handlers will be non final classes. And v5 is not starting to develop.

If you want to extend the class, make a feature request or send a PR.
CI4 is community driven. If many users want it, it will be changed.