Skip to content

No error thrown when accessing private and protected members of Kirby\Cms\App in a plugin #2394

@hdodov

Description

@hdodov

Describe the bug
In a plugin, you can access kirby()->roots and no error will be thrown. We had a discussion about that with @distantnative here.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the plainkit
  2. Create a plugin
  3. Put var_dump(kirby()->roots) in the plugin index.php file
  4. No error thrown

Expected behavior
An error should be thrown.

Kirby Version
3.3.2

Additional context
If you do var_dump(kirby()->roots) in a template, you correctly get the error:

Cannot access protected property Kirby\Cms\App::$roots

However, doing the same thing in a plugin works, and it shouldn't. @distantnative mentioned this might be due to the way hooks are triggered:

$function->call($this, ...$arguments);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions