Bug #70593 [Opn->Nab]: Logic behind debug_backtrace options
Edit report at https://bugs.php.net/bug.php?id=70593&edit=1
ID: 70593
Updated by: requinix@php.net
Reported by: david at davidsteinsland dot net
Summary: Logic behind debug_backtrace options
-Status: Open
+Status: Not a bug
Type: Bug
Package: Unknown/Other Function
Operating System: OSX
PHP Version: 5.6.13
Block user comment: N
Private report: N
New Comment:
PROVIDE_OBJECT is an opt-in flag: set this flag and you will get the object.
IGNORE_ARGS is an opt-out flag: set this flag and you will not get args.
If you do not want to opt-into getting the object do not want to opt-out of not getting the args
then pass 0.
https://3v4l.org/qj87i
If you absolutely must use the flags then the correct bitmask is
~(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS)
ie. negate the combination of both options. Or without the parentheses,
~DEBUG_BACKTRACE_PROVIDE_OBJECT & ~DEBUG_BACKTRACE_IGNORE_ARGS
Previous Comments:
------------------------------------------------------------------------
[2015-09-27 13:01:10] david at davidsteinsland dot net
Description:
------------
What is the logic behind the options in debug_backtrace? As far as I can see, there is no way of
getting only "args", and no "object" in the return value.
Option object args
~DEBUG_BACKTRACE_PROVIDE_OBJECT | ~DEBUG_BACKTRACE_IGNORE_ARGS 1 0
DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS 1 0
DEBUG_BACKTRACE_IGNORE_ARGS 0 0
~DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS 0 0
~DEBUG_BACKTRACE_PROVIDE_OBJECT 0 0
DEBUG_BACKTRACE_PROVIDE_OBJECT | ~DEBUG_BACKTRACE_IGNORE_ARGS 1 1
DEBUG_BACKTRACE_PROVIDE_OBJECT 1 1
~DEBUG_BACKTRACE_IGNORE_ARGS 1 1
With these two constants, there is only possible to:
- get object only
- get nothing
- get object and args
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70593&edit=1
Thread (2 messages)