debug_backtrace_options.phpt 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. --TEST--
  2. debug_backtrace options
  3. --FILE--
  4. <?php
  5. function backtrace_print($opt = null)
  6. {
  7. if(is_null($opt)) {
  8. print_r(debug_backtrace());
  9. } else {
  10. print_r(debug_backtrace($opt));
  11. }
  12. }
  13. function doit($a, $b, $how)
  14. {
  15. echo "==default\n";
  16. $how();
  17. echo "==true\n";
  18. $how(true);
  19. echo "==false\n";
  20. $how(false);
  21. echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
  22. $how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  23. echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
  24. $how(DEBUG_BACKTRACE_IGNORE_ARGS);
  25. echo "==both\n";
  26. $how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS);
  27. }
  28. class foo {
  29. protected function doCall($dowhat, $how)
  30. {
  31. $dowhat('a','b', $how);
  32. }
  33. static function statCall($dowhat, $how)
  34. {
  35. $obj = new self();
  36. $obj->doCall($dowhat, $how);
  37. }
  38. }
  39. foo::statCall("doit", "debug_print_backtrace");
  40. foo::statCall("doit", "backtrace_print");
  41. ?>
  42. --EXPECTF--
  43. ==default
  44. #0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
  45. #1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
  46. #2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
  47. ==true
  48. #0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
  49. #1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
  50. #2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
  51. ==false
  52. #0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
  53. #1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
  54. #2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
  55. ==DEBUG_BACKTRACE_PROVIDE_OBJECT
  56. #0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
  57. #1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
  58. #2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
  59. ==DEBUG_BACKTRACE_IGNORE_ARGS
  60. #0 %sdebug_backtrace_options.php(%d): doit()
  61. #1 %sdebug_backtrace_options.php(%d): foo->doCall()
  62. #2 %sdebug_backtrace_options.php(%d): foo::statCall()
  63. ==both
  64. #0 %sdebug_backtrace_options.php(%d): doit()
  65. #1 %sdebug_backtrace_options.php(%d): foo->doCall()
  66. #2 %sdebug_backtrace_options.php(%d): foo::statCall()
  67. ==default
  68. Array
  69. (
  70. [0] => Array
  71. (
  72. [file] => %sdebug_backtrace_options.php
  73. [line] => %d
  74. [function] => backtrace_print
  75. [args] => Array
  76. (
  77. )
  78. )
  79. [1] => Array
  80. (
  81. [file] => %sdebug_backtrace_options.php
  82. [line] => %d
  83. [function] => doit
  84. [args] => Array
  85. (
  86. [0] => a
  87. [1] => b
  88. [2] => backtrace_print
  89. )
  90. )
  91. [2] => Array
  92. (
  93. [file] => %sdebug_backtrace_options.php
  94. [line] => %d
  95. [function] => doCall
  96. [class] => foo
  97. [object] => foo Object
  98. (
  99. )
  100. [type] => ->
  101. [args] => Array
  102. (
  103. [0] => doit
  104. [1] => backtrace_print
  105. )
  106. )
  107. [3] => Array
  108. (
  109. [file] => %sdebug_backtrace_options.php
  110. [line] => %d
  111. [function] => statCall
  112. [class] => foo
  113. [type] => ::
  114. [args] => Array
  115. (
  116. [0] => doit
  117. [1] => backtrace_print
  118. )
  119. )
  120. )
  121. ==true
  122. Array
  123. (
  124. [0] => Array
  125. (
  126. [file] => %sdebug_backtrace_options.php
  127. [line] => 17
  128. [function] => backtrace_print
  129. [args] => Array
  130. (
  131. [0] => 1
  132. )
  133. )
  134. [1] => Array
  135. (
  136. [file] => %sdebug_backtrace_options.php
  137. [line] => %d
  138. [function] => doit
  139. [args] => Array
  140. (
  141. [0] => a
  142. [1] => b
  143. [2] => backtrace_print
  144. )
  145. )
  146. [2] => Array
  147. (
  148. [file] => %sdebug_backtrace_options.php
  149. [line] => %d
  150. [function] => doCall
  151. [class] => foo
  152. [object] => foo Object
  153. (
  154. )
  155. [type] => ->
  156. [args] => Array
  157. (
  158. [0] => doit
  159. [1] => backtrace_print
  160. )
  161. )
  162. [3] => Array
  163. (
  164. [file] => %sdebug_backtrace_options.php
  165. [line] => %d
  166. [function] => statCall
  167. [class] => foo
  168. [type] => ::
  169. [args] => Array
  170. (
  171. [0] => doit
  172. [1] => backtrace_print
  173. )
  174. )
  175. )
  176. ==false
  177. Array
  178. (
  179. [0] => Array
  180. (
  181. [file] => %sdebug_backtrace_options.php
  182. [line] => 19
  183. [function] => backtrace_print
  184. [args] => Array
  185. (
  186. [0] =>
  187. )
  188. )
  189. [1] => Array
  190. (
  191. [file] => %sdebug_backtrace_options.php
  192. [line] => %d
  193. [function] => doit
  194. [args] => Array
  195. (
  196. [0] => a
  197. [1] => b
  198. [2] => backtrace_print
  199. )
  200. )
  201. [2] => Array
  202. (
  203. [file] => %sdebug_backtrace_options.php
  204. [line] => %d
  205. [function] => doCall
  206. [class] => foo
  207. [type] => ->
  208. [args] => Array
  209. (
  210. [0] => doit
  211. [1] => backtrace_print
  212. )
  213. )
  214. [3] => Array
  215. (
  216. [file] => %sdebug_backtrace_options.php
  217. [line] => %d
  218. [function] => statCall
  219. [class] => foo
  220. [type] => ::
  221. [args] => Array
  222. (
  223. [0] => doit
  224. [1] => backtrace_print
  225. )
  226. )
  227. )
  228. ==DEBUG_BACKTRACE_PROVIDE_OBJECT
  229. Array
  230. (
  231. [0] => Array
  232. (
  233. [file] => %sdebug_backtrace_options.php
  234. [line] => 21
  235. [function] => backtrace_print
  236. [args] => Array
  237. (
  238. [0] => 1
  239. )
  240. )
  241. [1] => Array
  242. (
  243. [file] => %sdebug_backtrace_options.php
  244. [line] => %d
  245. [function] => doit
  246. [args] => Array
  247. (
  248. [0] => a
  249. [1] => b
  250. [2] => backtrace_print
  251. )
  252. )
  253. [2] => Array
  254. (
  255. [file] => %sdebug_backtrace_options.php
  256. [line] => %d
  257. [function] => doCall
  258. [class] => foo
  259. [object] => foo Object
  260. (
  261. )
  262. [type] => ->
  263. [args] => Array
  264. (
  265. [0] => doit
  266. [1] => backtrace_print
  267. )
  268. )
  269. [3] => Array
  270. (
  271. [file] => %sdebug_backtrace_options.php
  272. [line] => %d
  273. [function] => statCall
  274. [class] => foo
  275. [type] => ::
  276. [args] => Array
  277. (
  278. [0] => doit
  279. [1] => backtrace_print
  280. )
  281. )
  282. )
  283. ==DEBUG_BACKTRACE_IGNORE_ARGS
  284. Array
  285. (
  286. [0] => Array
  287. (
  288. [file] => %sdebug_backtrace_options.php
  289. [line] => 23
  290. [function] => backtrace_print
  291. )
  292. [1] => Array
  293. (
  294. [file] => %sdebug_backtrace_options.php
  295. [line] => %d
  296. [function] => doit
  297. )
  298. [2] => Array
  299. (
  300. [file] => %sdebug_backtrace_options.php
  301. [line] => %d
  302. [function] => doCall
  303. [class] => foo
  304. [type] => ->
  305. )
  306. [3] => Array
  307. (
  308. [file] => %sdebug_backtrace_options.php
  309. [line] => %d
  310. [function] => statCall
  311. [class] => foo
  312. [type] => ::
  313. )
  314. )
  315. ==both
  316. Array
  317. (
  318. [0] => Array
  319. (
  320. [file] => %sdebug_backtrace_options.php
  321. [line] => 25
  322. [function] => backtrace_print
  323. )
  324. [1] => Array
  325. (
  326. [file] => %sdebug_backtrace_options.php
  327. [line] => %d
  328. [function] => doit
  329. )
  330. [2] => Array
  331. (
  332. [file] => %sdebug_backtrace_options.php
  333. [line] => %d
  334. [function] => doCall
  335. [class] => foo
  336. [object] => foo Object
  337. (
  338. )
  339. [type] => ->
  340. )
  341. [3] => Array
  342. (
  343. [file] => %sdebug_backtrace_options.php
  344. [line] => %d
  345. [function] => statCall
  346. [class] => foo
  347. [type] => ::
  348. )
  349. )