Welcome Guest, Not a member yet? Register   Sign In
extention of autorouter in ci4.2
#1

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:
  • both new classes for auto-routing (AutoRouter and AutoRouterImproved) can't be extended, since they are both finalized
  • and they also seem to be instantiated directly via new keyword (e.g. https://github.com/codeigniter4/CodeIgni...r.php#L136) instead by some Service-method or equal
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
Reply
#2

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB