Skip to content

Commit a31167a

Browse files
committed
chore(agent): remove obsolete code (16/17) (#1085)
This PR removes obsolete `PHP7` codeblocks. PR: 16/17
1 parent 49dfc14 commit a31167a

File tree

4 files changed

+0
-42
lines changed

4 files changed

+0
-42
lines changed

agent/tests/test_call.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ static void test_callable(TSRMLS_D) {
7878
nr_php_zval_free(&callable);
7979
nr_php_zval_free(&retval);
8080

81-
#ifdef PHP7
8281
callable = tlib_php_request_eval_expr(
8382
"new class { function __invoke() { return 42; } }" TSRMLS_CC);
8483
retval = nr_php_call_callable(callable);
@@ -89,7 +88,6 @@ static void test_callable(TSRMLS_D) {
8988
(long)Z_LVAL_P(retval));
9089
nr_php_zval_free(&callable);
9190
nr_php_zval_free(&retval);
92-
#endif /* PHP7 */
9391

9492
/*
9593
* Test : With parameters.
@@ -150,7 +148,6 @@ static void test_callable(TSRMLS_D) {
150148
nr_php_zval_free(&callable);
151149
nr_php_zval_free(&retval);
152150

153-
#ifdef PHP7
154151
callable = tlib_php_request_eval_expr(
155152
"new class { function __invoke($n) { return square($n); } }" TSRMLS_CC);
156153
retval = nr_php_call_callable(callable, param);
@@ -161,7 +158,6 @@ static void test_callable(TSRMLS_D) {
161158
(long)Z_LVAL_P(retval));
162159
nr_php_zval_free(&callable);
163160
nr_php_zval_free(&retval);
164-
#endif /* PHP7 */
165161

166162
nr_php_zval_free(&param);
167163
tlib_php_request_end();

agent/tests/test_fw_codeigniter.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ static void invoke_cufa(TSRMLS_D) {
2727
}
2828

2929
static void test_get_topmost_user_op_array(TSRMLS_D) {
30-
#ifdef PHP7
3130
/*
3231
* First, we'll test this with call_user_func_array() inlining.
3332
*/
@@ -43,11 +42,6 @@ static void test_get_topmost_user_op_array(TSRMLS_D) {
4342
CG(compiler_options) |= ZEND_COMPILE_NO_BUILTINS;
4443
invoke_cufa(TSRMLS_C);
4544
tlib_php_request_end();
46-
#else
47-
tlib_php_request_start();
48-
invoke_cufa(TSRMLS_C);
49-
tlib_php_request_end();
50-
#endif /* PHP7 */
5145
}
5246

5347
tlib_parallel_info_t parallel_info = {.suggested_nthreads = 1, .state_size = 0};

agent/tests/test_pdo.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,9 @@ static void test_disable_persistence(TSRMLS_D) {
302302
"array(PDO::ATTR_PERSISTENT => false)" TSRMLS_CC);
303303

304304
for (i = 0; bad_options[i]; i++) {
305-
#ifdef PHP7
306305
if (IS_UNDEF == Z_TYPE_P(bad_options[i])) {
307306
continue;
308307
}
309-
#endif
310308

311309
input = nr_php_zval_alloc();
312310

agent/tests/tlib_php.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -600,16 +600,7 @@ tlib_php_internal_function_handler_t tlib_php_replace_internal_function(
600600
zend_class_entry* ce = NULL;
601601
char* lcclass = nr_string_to_lowercase(klass);
602602

603-
#ifdef PHP7
604603
ce = (zend_class_entry*)nr_php_zend_hash_find_ptr(CG(class_table), lcclass);
605-
#else
606-
zend_class_entry** ce_ptr
607-
= nr_php_zend_hash_find_ptr(CG(class_table), lcclass);
608-
609-
if (ce_ptr) {
610-
ce = *ce_ptr;
611-
}
612-
#endif /* PHP7 */
613604

614605
nr_free(lcclass);
615606
if (NULL == ce) {
@@ -670,7 +661,6 @@ zval* tlib_php_zval_create_default(zend_uchar type TSRMLS_DC) {
670661
nr_php_zval_str(zv, "");
671662
break;
672663

673-
#ifdef PHP7
674664
case IS_UNDEF:
675665
ZVAL_UNDEF(zv);
676666
break;
@@ -732,15 +722,6 @@ zval* tlib_php_zval_create_default(zend_uchar type TSRMLS_DC) {
732722
ZVAL_NEW_REF(zv, &refval);
733723
}
734724
break;
735-
#else
736-
case IS_BOOL:
737-
ZVAL_BOOL(zv, 0);
738-
break;
739-
740-
case IS_RESOURCE:
741-
ZEND_REGISTER_RESOURCE(zv, NULL, le_tlib);
742-
break;
743-
#endif /* PHP7 */
744725

745726
default:
746727
nr_php_zval_free(&zv);
@@ -750,17 +731,10 @@ zval* tlib_php_zval_create_default(zend_uchar type TSRMLS_DC) {
750731
return zv;
751732
}
752733

753-
#ifdef PHP7
754734
static const zend_uchar default_zval_types[] = {
755735
IS_UNDEF, IS_NULL, IS_FALSE, IS_TRUE, IS_LONG, IS_DOUBLE,
756736
IS_STRING, IS_ARRAY, IS_OBJECT, IS_RESOURCE, IS_REFERENCE,
757737
};
758-
#else
759-
static const zend_uchar default_zval_types[] = {
760-
IS_NULL, IS_LONG, IS_DOUBLE, IS_BOOL,
761-
IS_ARRAY, IS_OBJECT, IS_STRING, IS_RESOURCE,
762-
};
763-
#endif
764738

765739
zval** tlib_php_zvals_of_all_types(TSRMLS_D) {
766740
zval** arr;
@@ -829,11 +803,7 @@ char* tlib_php_zval_dump(zval* zv TSRMLS_DC) {
829803
}
830804

831805
tlib_php_request_eval("ob_start();" TSRMLS_CC);
832-
#ifdef PHP7
833806
php_var_dump(zv, 0);
834-
#else
835-
php_var_dump(&zv, 0 TSRMLS_CC);
836-
#endif
837807
result = tlib_php_request_eval_expr("ob_get_clean()" TSRMLS_CC);
838808
if (nr_php_is_zval_valid_string(result)) {
839809
dump = nr_strndup(Z_STRVAL_P(result), Z_STRLEN_P(result));

0 commit comments

Comments
 (0)