Skip to main content

PHP Agent v2.4.0

Release date: 2021-12-16

Change (update)

PHP 8.1

PHP 8.1 is supported.

Fixed (bug fixing)

cURL header setting data initialization error

When setting the HTTP header (CURLOPT_HTTPHEADER) through the curl_setopt and curl_setopt_array functions, if duplicate settings are made, the previous data is initialized and the new data is set.

When the multi-transaction (whatap.mtrace_enabled=true) setting is enabled, there is an error in which the previous user header data is initialized by setting the Whatap Header data before the curl_exec() function.

The function to set the WhaTap Header has been removed before calling the curl_exec() function and it has been modified to set it after calling the curl_init() function.

If the user header is set before the curl_exec() function is called, the WhatTap header set in advance is deleted.

To do multi-transaction, add the WhatTap header directly in the PHP source code according to the following guide.

Sample source code /usr/whatap/php/lib/Whatap/sample_mtrace.php

php
// Whatap installation directory (/usr/whatap/php/lib/Whatap/Whatap.php)  
// Load Whatap.php.
include_once './Whatap.php';

...

// User header information
$headers = array();
array_push($headers, "aaaa:bbbb");

// Add the Whatap header
$whatap_mtrace = Whatap::whatap_get_mtrace();
foreach ($whatap_mtrace as $key => $value){
//echo $key."=".$value."<br/>";
array_push($headers, "$key:$value");
}
unset($value);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
...

You can adjust the automatic setup function with the following settings:

whatap.mtrace_auto_inject_enabled=true

  • After calling the curl_init() function, the whatap header is set while internally calling curl_setopt().
  • false: The automatic setting for the WhaTap header is stopped.