Req #68615 [NEW]: Faster / slimmer alternative to debug_backtrace
| From: | ianbytchek at gmail dot com | Date: | Wed, 17 Dec 2014 08:31:05 +0000 |
| Subject: | Req #68615 [NEW]: Faster / slimmer alternative to debug_backtrace | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-189094@lists.php.net to get a copy of this message | ||
From: ianbytchek at gmail dot com
Operating system:
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Faster / slimmer alternative to debug_backtrace
Description:
------------
debug_backtrace is a really useful and powerful thing, but often its
purpose ends with debugging-related tasks. I stumble across use-cases
where it can be just as useful, but the performance is dragging it down.
One of such use cases is (semi) automatic dependency injection
implemented by referencing caller objects. E.g., when a controller
implements an
InjectionAwareInterface a model instantiated within the
call tree can find the closest InjectionAwareInterface and use
dependencies from there. Having the ability to quickly and efficiently
extract the caller information would allow to produce cleaner and more
robust code.
Please consider providing the new get_backtrace_objects() function,
which would return only an array of caller objects without repetitive
duplicates, i.e., when different methods are called from a single class,
both get into debug_backtrace with the same object value, with
get_backtrace_objects this would be a single entry.
I understand the functionality is already present in the
debug_backtrace, however using that to get the list of caller objects
adds a massive overhead for also generating other debug-related
information. Extracting the objects makes it even slower.
--
Edit bug report at https://bugs.php.net/bug.php?id=68615&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68615&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68615&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68615&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68615&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68615&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68615&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68615&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68615&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68615&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68615&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68615&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68615&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68615&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68615&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68615&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68615&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68615&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68615&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68615&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68615&r=mysqlcfg