Req #73976 [NEW]: getClosure() always returning the same object?
From: nobotsplease at example dot org
Operating system:
PHP version: Irrelevant
Package: Reflection related
Bug Type: Feature/Change Request
Bug description:getClosure() always returning the same object?
Description:
------------
Would it be possible if ReflectionMethod and ReflectionFunction's
getClosure() methods always returned the same Closure object? e.g:
class Foo{ function bar(){} }
$a = new ReflectionMethod('Foo', 'bar');
$b = new ReflectionMethod('Foo', 'bar');
$foo = new Foo();
$aa = $a->getClosure($foo);
$bb = $b->getClosure($foo);
assert($aa == $bb);
assert($aa === $bb);
Object that would have the same lifetime of the object the variable
$this is set to ($foo, in previous example). It would be nice if we were
allowed to use === operator for comparison. Similarly
$aa = $a->getClosure($foo)->bindTo($foo, 'static');
$bb = $b->getClosure($foo)->bindTo($foo, 'static');
assert($aa == $bb);
assert($aa === $bb);
might also be valid, but I imagine this would complicate things
enormously.
Thank you in advance.
--
Edit bug report at https://bugs.php.net/bug.php?id=73976&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73976&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73976&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73976&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73976&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73976&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73976&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73976&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73976&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73976&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73976&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73976&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73976&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73976&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73976&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73976&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73976&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73976&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73976&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73976&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73976&r=mysqlcfg
Thread (2 messages)
- nobotsplease at example dot org