Search code examples
phpmagentomagic-methods

Error with __Call on magento


I can't figure this out,

I have a method on my class like:

public function __call($closure, $args){
     return call_user_func_array($this->{$closure}->bindTo($this),$args);
}

This works on my local server on magento, but when I try to use it on my server it returns me the following error:

Fatal error: Call to undefined method Closure::bindTo() in

I tried adding var_dump to the variables, all have the correct values.

Any ideas?


Solution

  • Closure::bindTo exists in PHP 5.4 or newer only. Check your PHP version.

    http://php.net/manual/en/closure.bindto.php