Plugin as URL handler: init() not called

I registerd my plugin as URL handler via IHandler. Now when the method is actually called, my plugin does not have the $host parameter set anymore.

URL:

/backend.php?op=micropub&method=action

Reason is that backend.php simply does

$handler = new $op($_REQUEST);

and does not call init() on it, so $plugin->hook never gets initialized.

I think it would be sensible tore-use the existing plugin object instead of re-instantiating the plugin class.

this is probably done in this fashion because you’re modifying routing which has security implications, might not have a user logged on, or any plugins already loaded, so it makes sense to have a clean object to handle the request separately

modifying routing is kind of a niche thing anyway normal plugins should be going through pluginmethod which allows them to be user-loaded, see imgproxy and many others for an example, i recommend you do that instead

e: a few edits, i guess i mostly forgot how these things work unicode shrug