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

Used $this in lambda function #1

Open
Sarbinski opened this issue Apr 3, 2017 · 0 comments
Open

Used $this in lambda function #1

Sarbinski opened this issue Apr 3, 2017 · 0 comments

Comments

@Sarbinski
Copy link

Sarbinski commented Apr 3, 2017

File /2_d_event_manager-master/system/library/d_event_manager/loader.php on Line 152 and 185

public function callback($registry, $route) {
		return function($args) use($registry, &$route) {
			static $model = array(); 			
			
			$output = null;
			
			// Trigger the pre events
			$result = $this->event->trigger('model/' . $route . '/before', array(&$route, &$args, &$output));

You can't use $this inside Anonymous function :) (PHP <5.4)
Suggested fix:
Declare a new variable for $this->event and pass it by value throw use modificator.
Cheers!

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

1 participant