Skip to content

Commit 416b04a

Browse files
committed
move lib_zend to lib_laminas
1 parent 2127630 commit 416b04a

2 files changed

Lines changed: 11 additions & 46 deletions

File tree

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,18 @@ typedef enum _nr_zend_http_adapter {
2525
*
2626
* Refer to the manual for up to date specs:
2727
* https://docs.laminas.dev/
28-
*
29-
* In order to toggle between `zend` and `laminas` naming schemes, the names
30-
* are stored in defines. The default is the `zend` naming scheme.
31-
* If `laminas` is detected, the values are redefined in this file's
32-
* `nr_laminas_http_enable` function.
3328
*/
34-
#define LIB_NAME_Z "Zend"
35-
#define CURL_ADAPTER_Z "Zend_Http_Client_Adapter_Curl"
36-
#define URI_HTTP_Z "Zend_Uri_Http"
37-
#define HTTP_CLIENT_Z "Zend_Http_Client"
38-
#define HTTP_CLIENT_REQUEST_Z "Zend_Http_Client::request"
39-
4029
#define LIB_NAME_L "Laminas"
4130
#define CURL_ADAPTER_L "Laminas\\Http\\Client\\Adapter\\Curl::class"
4231
#define URI_HTTP_L "Laminas\\Uri\\Http"
4332
#define HTTP_CLIENT_L "Laminas\\Http\\Client"
4433
#define HTTP_CLIENT_REQUEST_L "Laminas\\Http\\Client::send"
4534

46-
char* library_name = LIB_NAME_Z;
47-
char* curl_adapter_typename = CURL_ADAPTER_Z;
48-
char* uri_http_typename = URI_HTTP_Z;
49-
char* http_client = HTTP_CLIENT_Z;
50-
char* http_client_request = HTTP_CLIENT_REQUEST_Z;
35+
char* library_name = LIB_NAME_L;
36+
char* curl_adapter_typename = CURL_ADAPTER_L;
37+
char* uri_http_typename = URI_HTTP_L;
38+
char* http_client = HTTP_CLIENT_L;
39+
char* http_client_request = HTTP_CLIENT_REQUEST_L;
5140

5241
/*
5342
* Purpose : Determine which HTTP client adapter is being used by a Zend
@@ -126,14 +115,10 @@ static nr_zend_http_adapter nr_zend_check_adapter(zval* this_var TSRMLS_DC) {
126115
}
127116

128117
/*
129-
* Purpose : For Zend, get the url of a Zend_Http_Client instance before a
130-
* Zend_Http_Client::request call.
131-
* For Laminas, get the url of a Zend_Http_Client instance before a
118+
* Purpose : For Laminas, get the url of a Zend_Http_Client instance before a
132119
* Laminas_Http_Client::send call.
133120
*
134-
* Params : 1. For Zend, the instance receiver of the
135-
* Zend_Http_Client::request call.
136-
* For Laminas, the instance receiver of the
121+
* Params : 1. For Laminas, the instance receiver of the
137122
* Zend_Http_Client::send call.
138123
* 2. A pointer to a string that will receive the URL. It is the
139124
* responsibility of the caller to free this URL.
@@ -323,10 +308,7 @@ static uint64_t nr_zend_http_client_request_get_response_code(
323308
}
324309

325310
/*
326-
* Wrap and record external metrics for Zend_Http_Client::request.
327311
* Wrap and record external metrics for Laminas_Http_Client::send.
328-
*
329-
* http://framework.zend.com/manual/1.12/en/zend.http.client.advanced.html
330312
*/
331313
NR_PHP_WRAPPER_START(nr_zend_http_client_request) {
332314
zval* this_var = NULL;
@@ -367,8 +349,7 @@ NR_PHP_WRAPPER_START(nr_zend_http_client_request) {
367349
* This solution of purely for Zend_Http_Client issues related to older
368350
* versions of the Zend framework.
369351
*
370-
* Our agent creates an external segment for calls to `request` method calls
371-
* of `Zend_Http_Client` objects or for calls to `send` method calls
352+
* Our agent creates an external segment for calls `send` method calls
372353
* of `Laminas_Http_Client` objects. However, the request method itself
373354
* creates child segments to the external segments triggered by our automatic
374355
* instrumentation. These child segments are not correctly parented, to the
@@ -377,8 +358,8 @@ NR_PHP_WRAPPER_START(nr_zend_http_client_request) {
377358
* related to the stacked segment implementation in the agent. This
378359
* implementation relies on the fact that segments created in the agent
379360
* explicitly do not have children created by automatic instrumentation.
380-
* Implement a solution just for `Zend_Http_Client` (e. g. deleting all child
381-
* segments from the `request` related segment).
361+
* Implement a solution just for `Laminas_Http_Client` (e. g. deleting all
362+
* child segments from the `request` related segment).
382363
*/
383364
#if ZEND_MODULE_API_NO < ZEND_8_0_X_API_NO \
384365
|| defined OVERWRITE_ZEND_EXECUTE_DATA /* not OAPI */
@@ -409,7 +390,7 @@ NR_PHP_WRAPPER_START(nr_zend_http_client_request) {
409390
}
410391

411392
/*
412-
* We don't want to have Zend_Http_Client request segments to have any
393+
* We don't want to have Laminas_Http_Client request segments to have any
413394
* children, as this would scramble the exclusive time calculation.
414395
*
415396
* Therefore we delete all children of the segment. Afterwards we set
@@ -440,23 +421,7 @@ NR_PHP_WRAPPER_START(nr_zend_http_client_request) {
440421
}
441422
NR_PHP_WRAPPER_END
442423

443-
void nr_zend_http_enable(TSRMLS_D) {
444-
if (NR_FW_LAMINAS3 != NRPRG(current_framework)) {
445-
nr_php_wrap_user_function(NR_PSTR(HTTP_CLIENT_REQUEST_Z),
446-
nr_zend_http_client_request TSRMLS_CC);
447-
}
448-
}
449-
450424
void nr_laminas_http_enable(TSRMLS_D) {
451-
/*
452-
* Redefine zend to laminas.
453-
*/
454-
library_name = LIB_NAME_L;
455-
curl_adapter_typename = CURL_ADAPTER_L;
456-
uri_http_typename = URI_HTTP_L;
457-
http_client = HTTP_CLIENT_L;
458-
http_client_request = HTTP_CLIENT_REQUEST_L;
459-
460425
nr_php_wrap_user_function(NR_PSTR(HTTP_CLIENT_REQUEST_L),
461426
nr_zend_http_client_request TSRMLS_CC);
462427
}

0 commit comments

Comments
 (0)