Skip to content

Commit 4f470da

Browse files
authored
Merge pull request #884 from newrelic/dev
Release 10.20
2 parents 2c9bf20 + 85d74db commit 4f470da

File tree

167 files changed

+2994
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+2994
-111
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2020 New Relic Corporation. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
5+
name: bug-report-response
6+
7+
on:
8+
issues:
9+
types:
10+
- labeled
11+
12+
jobs:
13+
bug-report-response:
14+
if: github.event.label.name == 'bug' && github.event.issue.state == 'open'
15+
uses: ./.github/workflows/issue-comment.yml
16+
with:
17+
issue-number: ${{ github.event.issue.number }}
18+
message: >
19+
Thank you for your issue report. A member of the New Relic PHP Agent Team
20+
will review your report and endeavor to respond in a timely manner.
21+
22+
Need troubleshooting help? Please review some of our common troubleshooting documentation, starting with [generating debug logs](https://docs.newrelic.com/docs/apm/agents/php-agent/troubleshooting/generating-logs-troubleshooting-php/).
23+
From there, additional resources and tips are available in our troubleshooting section, accessible from the left-hand panel of our documentation site. Additionally, please be sure to visit
24+
our [Explorer's Hub](https://forum.newrelic.com/s/), where other members of the community may have solved an issue similar to yours with the help of our Support team members.
25+
26+
Have a question regarding support for an Operating System, PHP Version, Framework, or Library?
27+
Please take a look at our [Compatibility Docs](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/).
28+
29+
Binary support for ARM-based CPU architecture is now available via the [tarball installation](https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-arm64/#tarball-installation) method for PHP Versions 8.0+!
30+
31+
General installation instructions can be found on our [Installation Overview](https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-overview/) page.
32+
33+
Need more information about an Agent INI setting? Our [Configuration](https://docs.newrelic.com/docs/apm/agents/php-agent/configuration/php-agent-configuration/)
34+
page contains an explanation for each INI setting and how to modify the defaults.
35+
36+
Looking for something else? All New Relic PHP Agent Documentation can be found under our [Introduction](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/) page.

.github/workflows/issue-comment.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2020 New Relic Corporation. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
5+
name: issue-comment
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
issue-number:
11+
type: number
12+
required: true
13+
message:
14+
type: string
15+
required: true
16+
17+
jobs:
18+
post-comment:
19+
runs-on: ubuntu-latest
20+
env:
21+
GH_TOKEN: ${{ secrets.ISSUE_BOT_TOKEN }}
22+
steps:
23+
- name: respond to issue
24+
run: |
25+
gh issue comment ${{ inputs.issue-number }} --body ${{ inputs.message }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2020 New Relic Corporation. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
5+
name: issue-support-label
6+
7+
on:
8+
issues:
9+
types:
10+
- labeled
11+
12+
jobs:
13+
support-response:
14+
if: github.event.label.name == 'support' && github.event.issue.state == 'open'
15+
uses: ./.github/workflows/issue-comment.yml
16+
with:
17+
issue-number: ${{ github.event.issue.number }}
18+
message: >
19+
This issue has been identified as requiring additional information to debug.
20+
Due to the potentially sensitive nature of the information we may have to collect,
21+
such as PHPInfo and Debug Logs, please follow [these steps](https://docs.newrelic.com/docs/new-relic-solutions/solve-common-issues/find-help-use-support-portal/#file-ticket)
22+
to create a support case, where a member of our New Relic Support Team will work
23+
with you to gather the necessary information securely and help debug your issue.
24+
25+
If your subscription level does not include technical support, the
26+
other option available to customers is to use New Relic’s community support channel: [Explorers Hub](https://forum.newrelic.com/s/). From there, a member of our New Relic Support Team will work
27+
with you to gather the necessary information securely and help debug your issue.
28+
For all available options on how to get support, please see [these resources](https://docs.newrelic.com/docs/new-relic-solutions/solve-common-issues/find-help-use-support-portal/).

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.19.0
1+
10.20.0

agent/fw_drupal8.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "util_memory.h"
1919
#include "util_strings.h"
2020

21+
#define PHP_PACKAGE_NAME "drupal/core"
22+
2123
/*
2224
* Purpose : Convenience function to handle adding a callback to a method,
2325
* given a class entry and a method name. This will check the
@@ -684,7 +686,11 @@ void nr_drupal_version() {
684686
// Add php package to transaction
685687
if (nr_php_is_zval_valid_string(zval_version)) {
686688
char* version = Z_STRVAL_P(zval_version);
687-
nr_txn_add_php_package(NRPRG(txn), "drupal/core", version);
689+
if (NRINI(vulnerability_management_package_detection_enabled)) {
690+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
691+
}
692+
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
693+
version);
688694
}
689695

690696
nr_php_zval_free(&zval_version);
@@ -753,7 +759,7 @@ void nr_drupal8_enable(TSRMLS_D) {
753759
}
754760

755761
if (NRINI(vulnerability_management_package_detection_enabled)) {
756-
nr_txn_add_php_package(NRPRG(txn), "drupal/core",
762+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME,
757763
PHP_PACKAGE_VERSION_UNKNOWN);
758764
}
759765
}

agent/fw_hooks.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ extern void nr_symfony4_enable(TSRMLS_D);
3939
extern void nr_silex_enable(TSRMLS_D);
4040
extern void nr_slim_enable(TSRMLS_D);
4141
extern void nr_wordpress_enable(TSRMLS_D);
42-
extern void nr_yii_enable(TSRMLS_D);
42+
extern void nr_yii1_enable(TSRMLS_D);
43+
extern void nr_yii2_enable(TSRMLS_D);
4344
extern void nr_zend_enable(TSRMLS_D);
4445
extern void nr_fw_zend2_enable(TSRMLS_D);
4546

agent/fw_laravel.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include "ext/standard/php_versioning.h"
2525
#include "Zend/zend_exceptions.h"
2626

27+
#define PHP_PACKAGE_NAME "laravel/framework"
28+
2729
/*
2830
* This instruments Laravel 4.0-5.0, inclusive.
2931
* There is no support for Laravel 3.X or earlier.
@@ -959,8 +961,10 @@ NR_PHP_WRAPPER(nr_laravel_application_construct) {
959961

960962
if (NRINI(vulnerability_management_package_detection_enabled)) {
961963
// Add php package to transaction
962-
nr_txn_add_php_package(NRPRG(txn), "laravel/framework", version);
964+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
963965
}
966+
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
967+
version);
964968

965969
if (version) {
966970
nrl_debug(NRL_FRAMEWORK, "Laravel version is " NRP_FMT, NRP_PHP(version));

agent/fw_slim.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "fw_support.h"
1313
#include "util_logging.h"
1414

15+
#define PHP_PACKAGE_NAME "slim/slim"
16+
1517
static char* nr_slim_path_from_route(zval* route TSRMLS_DC) {
1618
zval* name = NULL;
1719
zval* pattern = NULL;
@@ -119,8 +121,13 @@ NR_PHP_WRAPPER(nr_slim_application_construct) {
119121

120122
version = nr_php_get_object_constant(this_var, "VERSION");
121123

122-
// Add php package to transaction
123-
nr_txn_add_php_package(NRPRG(txn), "slim/slim", version);
124+
if (NRINI(vulnerability_management_package_detection_enabled)) {
125+
// Add php package to transaction
126+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
127+
}
128+
129+
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
130+
version);
124131

125132
nr_free(version);
126133
nr_php_scope_release(&this_var);
@@ -139,13 +146,11 @@ void nr_slim_enable(TSRMLS_D) {
139146
nr_php_wrap_user_function(NR_PSTR("Slim\\Routing\\Route::run"),
140147
nr_slim3_4_route_run TSRMLS_CC);
141148

142-
if (NRINI(vulnerability_management_package_detection_enabled)) {
143-
/* Slim 2 does not have the same path as Slim 3/4 which is why
144-
we need to separate these*/
145-
nr_php_wrap_user_function(NR_PSTR("Slim\\Slim::__construct"),
146-
nr_slim_application_construct);
149+
/* Slim 2 does not have the same path as Slim 3/4 which is why
150+
we need to separate these*/
151+
nr_php_wrap_user_function(NR_PSTR("Slim\\Slim::__construct"),
152+
nr_slim_application_construct);
147153

148-
nr_php_wrap_user_function(NR_PSTR("Slim\\App::__construct"),
149-
nr_slim_application_construct);
150-
}
154+
nr_php_wrap_user_function(NR_PSTR("Slim\\App::__construct"),
155+
nr_slim_application_construct);
151156
}

agent/fw_support.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "util_memory.h"
1212
#include "util_strings.h"
1313

14+
#define MAJOR_VERSION_LENGTH 8
15+
1416
void nr_php_framework_add_supportability_metric(const char* framework_name,
1517
const char* name TSRMLS_DC) {
1618
char buf[512];
@@ -52,3 +54,36 @@ void nr_fw_support_add_logging_supportability_metric(nrtxn_t* txn,
5254
nrm_force_add(txn->unscoped_metrics, metname, 0);
5355
nr_free(metname);
5456
}
57+
58+
void nr_fw_support_add_package_supportability_metric(
59+
nrtxn_t* txn,
60+
const char* package_name,
61+
const char* package_version) {
62+
if (NULL == txn || NULL == package_name || NULL == package_version) {
63+
return;
64+
}
65+
66+
char* metname = NULL;
67+
char major_version[MAJOR_VERSION_LENGTH] = {0};
68+
69+
/* The below for loop checks if the major version of the package is more than
70+
* one digit and keeps looping until a '.' is encountered or one of the
71+
* conditions is met.
72+
*/
73+
for (int i = 0; package_version[i] && i < MAJOR_VERSION_LENGTH - 1; i++) {
74+
if ('.' == package_version[i]) {
75+
break;
76+
}
77+
major_version[i] = package_version[i];
78+
}
79+
80+
if (NR_FW_UNSET == NRINI(force_framework)) {
81+
metname = nr_formatf("Supportability/PHP/package/%s/%s/detected",
82+
package_name, major_version);
83+
} else {
84+
metname = nr_formatf("Supportability/PHP/package/%s/%s/forced",
85+
package_name, major_version);
86+
}
87+
nrm_force_add(txn->unscoped_metrics, metname, 0);
88+
nr_free(metname);
89+
}

agent/fw_support.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,17 @@ extern void nr_fw_support_add_logging_supportability_metric(
3838
const char* library_name,
3939
const bool is_enabled);
4040

41+
/*
42+
* Purpose: Add 'Supportability/PHP/package/{package}/{version}/detected' metric
43+
*
44+
* Params : 1. Transaction object
45+
* 2. Package name
46+
* 3. Package version
47+
*
48+
*/
49+
extern void nr_fw_support_add_package_supportability_metric(
50+
nrtxn_t* txn,
51+
const char* package_name,
52+
const char* package_version);
53+
4154
#endif /* FW_SUPPORT_HDR */

agent/fw_wordpress.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#define NR_WORDPRESS_HOOK_PREFIX "Framework/WordPress/Hook/"
2323
#define NR_WORDPRESS_PLUGIN_PREFIX "Framework/WordPress/Plugin/"
24+
#define PHP_PACKAGE_NAME "wordpress"
2425

2526
static nr_regex_t* wordpress_hook_regex;
2627

@@ -809,7 +810,11 @@ void nr_wordpress_version() {
809810
if (SUCCESS == result) {
810811
if (nr_php_is_zval_valid_string(&retval)) {
811812
char* version = Z_STRVAL(retval);
812-
nr_txn_add_php_package(NRPRG(txn), "wordpress", version);
813+
if (NRINI(vulnerability_management_package_detection_enabled)) {
814+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
815+
}
816+
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
817+
version);
813818
}
814819
zval_dtor(&retval);
815820
}
@@ -865,7 +870,7 @@ void nr_wordpress_enable(TSRMLS_D) {
865870
#endif /* OAPI */
866871

867872
if (NRINI(vulnerability_management_package_detection_enabled)) {
868-
nr_txn_add_php_package(NRPRG(txn), "wordpress",
873+
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME,
869874
PHP_PACKAGE_VERSION_UNKNOWN);
870875
}
871876
}

0 commit comments

Comments
 (0)