I reported a bug some weeks ago regarding how is_callable() works in PHP 5.4:
https://bugs.php.net/bug.php?id=51527 Here's the situation: class Foo { public function bar() { return __METHOD__; } } If I create a callback with either of these values: * $callback = 'Foo::bar'; * $callback = array('Foo', 'Bar'); is_callable() now returns true. In PHP 5.2 and 5.3, it returned false, which is what I'd expect. The argument made in the comments to that issue are, "well, technically you can call it; it just raises an E_STRICT." That's true. Unless the method actually utilizes $this, in which case you get a fatal: "Using $this when not in object context." And I can think of precisely zero situations where I'd want to call a non-static method statically and expect it to work. The point is: if I call is_callable() and it returns true, I should have a reasonable expectation that calling the callback will now work. In 5.3, I could make that assumption. In 5.4, that breaks, and I now have to go to some lengths to validate my callbacks. Sure, I could rely on PHP's error handling, but I'd much rather raise an exception or branch my logic so I can handle it gracefully within the application. I propose that when a string callback referencing a static method call OR an array callback referencing a static method call refers to a method that is not marked static, is_callable() should return false. -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php