Skip to content

Instantly share code, notes, and snippets.

@Firehed
Created May 23, 2013 21:24
Show Gist options
  • Save Firehed/5639541 to your computer and use it in GitHub Desktop.
Save Firehed/5639541 to your computer and use it in GitHub Desktop.
triggers E_ERROR: "Cannot call overloaded function for non-object" on line 13
<?php
private function getKey() {
if ($this->foo) {
$config = get_config();
if (!isset($config['func']) || !is_callable($config['func'])) {
throw new Exception("Function missing")
}
$func = $config['func'];
}
else {
$func = function(model $m) { /* do some stuff */ };
}
return $func($this->m);
}
@Firehed
Copy link
Author

Firehed commented May 23, 2013

the closure on line 11 has the same signature as the callable returned in the config and set on line 8, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment