13
13
#include "util_strings.h"
14
14
#include "util_syscalls.h"
15
15
#include "util_logging.h"
16
-
17
- #ifdef PHP7
18
16
#include "zend_generators.h"
19
- #endif
20
17
21
18
static int nr_php_stack_iterator (zval * frame ,
22
19
nrobj_t * arr ,
@@ -185,8 +182,6 @@ typedef struct _nr_php_frame_info_t {
185
182
int decl_line ; /* starting line number of the declaration site */
186
183
} nr_php_frame_info_t ;
187
184
188
- #ifdef PHP7
189
-
190
185
static int nr_php_is_include_or_eval (zend_execute_data * ex ) {
191
186
zend_execute_data * prev ;
192
187
@@ -336,106 +331,6 @@ static void nr_php_frame_info(nr_php_frame_info_t* info,
336
331
}
337
332
}
338
333
339
- #else /* PHP7 */
340
-
341
- static void nr_php_frame_info (nr_php_frame_info_t * info ,
342
- zend_execute_data * ex TSRMLS_DC ) {
343
- zend_function * func ;
344
-
345
- info -> class_name = "" ;
346
- info -> call_type = "" ;
347
- info -> func_name = "" ;
348
- info -> file = "" ;
349
- info -> line = 0 ;
350
- info -> decl_file = "" ;
351
- info -> decl_line = 0 ;
352
-
353
- if (NULL == ex ) {
354
- return ;
355
- }
356
-
357
- info -> func_name = "unknown" ;
358
- func = ex -> function_state .function ;
359
-
360
- if (NULL == func ) {
361
- return ;
362
- }
363
-
364
- if (ex -> op_array && ex -> opline ) {
365
- info -> file = ex -> op_array -> filename ;
366
- info -> line = ex -> opline -> lineno ;
367
- }
368
-
369
- /*
370
- * For closures, gather the file and line where the closure was declared
371
- * in addition to the file and line of the call site.
372
- */
373
- if ((ZEND_USER_FUNCTION == func -> type )
374
- && (func -> common .fn_flags & ZEND_ACC_CLOSURE )) {
375
- info -> decl_file = func -> op_array .filename ;
376
- info -> decl_line = func -> op_array .line_start ;
377
- }
378
-
379
- if (func -> common .function_name ) {
380
- info -> func_name = func -> common .function_name ;
381
-
382
- if (ex -> object ) {
383
- info -> call_type = "->" ;
384
-
385
- /*
386
- * Ignore the scope for closures, it's redundant given the file and
387
- * line where the closure was declared.
388
- */
389
- if (0 == (func -> common .fn_flags & ZEND_ACC_CLOSURE )) {
390
- if (func -> common .scope ) {
391
- info -> class_name = func -> common .scope -> name ;
392
- } else {
393
- /*
394
- * A method was invoked, but the runtime did not set the scope?
395
- * It's unclear how/when this can happen, but the Zend Engine handles
396
- * this case, so handle it here too.
397
- */
398
- if (Z_OBJCE_P (ex -> object ) && Z_OBJCE_P (ex -> object )-> name ) {
399
- info -> class_name = Z_OBJCE_P (ex -> object )-> name ;
400
- } else {
401
- info -> class_name = "???" ;
402
- }
403
- }
404
- }
405
- } else if (func -> common .scope ) {
406
- info -> call_type = "::" ;
407
- info -> class_name = func -> common .scope -> name ;
408
- }
409
-
410
- return ;
411
- }
412
-
413
- if (ex -> opline && ex -> opline -> opcode == ZEND_INCLUDE_OR_EVAL ) {
414
- switch (ex -> opline -> extended_value ) {
415
- case ZEND_EVAL :
416
- info -> func_name = "eval" ;
417
- break ;
418
- case ZEND_INCLUDE :
419
- info -> func_name = "include" ;
420
- break ;
421
- case ZEND_REQUIRE :
422
- info -> func_name = "require" ;
423
- break ;
424
- case ZEND_INCLUDE_ONCE :
425
- info -> func_name = "include_once" ;
426
- break ;
427
- case ZEND_REQUIRE_ONCE :
428
- info -> func_name = "require_once" ;
429
- break ;
430
- default :
431
- info -> func_name = "ZEND_INCLUDE_OR_EVAL" ;
432
- break ;
433
- }
434
- }
435
- }
436
-
437
- #endif /* PHP7 */
438
-
439
334
/*
440
335
Output format:
441
336
@@ -455,9 +350,7 @@ void nr_php_backtrace_fd(int fd, int limit TSRMLS_DC) {
455
350
ex = EG (current_execute_data );
456
351
457
352
while (ex ) {
458
- #ifdef PHP7
459
353
ex = zend_generator_check_placeholder_frame (ex );
460
- #endif
461
354
462
355
nr_php_frame_info (& frame , ex TSRMLS_CC );
463
356
0 commit comments