php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70593 Logic behind debug_backtrace options
Submitted: 2015-09-27 13:01 UTC Modified: 2015-09-27 13:50 UTC
From: david at davidsteinsland dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.6.13 OS: OSX
Private report: No CVE-ID: None
 [2015-09-27 13:01 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-27 13:50 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-09-27 13:50 UTC] requinix@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 20:01:32 2024 UTC