From 00c32015860c4ae61db3529573c2ac57058135a4 Mon Sep 17 00:00:00 2001 From: Andrii Pukhalevych Date: Thu, 29 Dec 2022 18:08:09 +0200 Subject: [PATCH] Clean strtok buffer from memory https://www.php.net/manual/en/function.strtok.php#103051 `strtok` function holds input string parameter (or reference to it?) in memory after usage. --- restclient.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/restclient.php b/restclient.php index 2d55d5e..38eb92a 100755 --- a/restclient.php +++ b/restclient.php @@ -208,6 +208,7 @@ public function execute(string $url, string $method='GET', $parameters=[], array $client->error = curl_error($client->handle); curl_close($client->handle); + return $client; } @@ -241,6 +242,7 @@ public function parse_response($response) : void { $this->headers = (object) $headers; $this->response = strtok(""); + strtok("", ""); // Clean strtok buffer from memory } public function get_response_format() : string {