Skip to content

Commit c3f8d28

Browse files
committed
chore(agent): remove obsolete code (12/17) (#1081)
This PR removes obsolete `PHP7` codeblocks. PR: 12/17
1 parent b42139a commit c3f8d28

File tree

1 file changed

+0
-107
lines changed

1 file changed

+0
-107
lines changed

agent/php_stack.c

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
#include "util_strings.h"
1414
#include "util_syscalls.h"
1515
#include "util_logging.h"
16-
17-
#ifdef PHP7
1816
#include "zend_generators.h"
19-
#endif
2017

2118
static int nr_php_stack_iterator(zval* frame,
2219
nrobj_t* arr,
@@ -185,8 +182,6 @@ typedef struct _nr_php_frame_info_t {
185182
int decl_line; /* starting line number of the declaration site */
186183
} nr_php_frame_info_t;
187184

188-
#ifdef PHP7
189-
190185
static int nr_php_is_include_or_eval(zend_execute_data* ex) {
191186
zend_execute_data* prev;
192187

@@ -336,106 +331,6 @@ static void nr_php_frame_info(nr_php_frame_info_t* info,
336331
}
337332
}
338333

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-
439334
/*
440335
Output format:
441336
@@ -455,9 +350,7 @@ void nr_php_backtrace_fd(int fd, int limit TSRMLS_DC) {
455350
ex = EG(current_execute_data);
456351

457352
while (ex) {
458-
#ifdef PHP7
459353
ex = zend_generator_check_placeholder_frame(ex);
460-
#endif
461354

462355
nr_php_frame_info(&frame, ex TSRMLS_CC);
463356

0 commit comments

Comments
 (0)