From 0b06e6b94a533709927da32e78123e097532b383 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <machniak@kolabsys.com>
Date: Tue, 9 Apr 2019 11:12:18 +0200
Subject: [PATCH] Optimize _string2hex()

---
 lib/Net/LDAP3.php | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 7df93ad..69d0cc7 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -2734,11 +2734,7 @@ class Net_LDAP3
      */
     private static function _string2hex($str)
     {
-        $hex = '';
-        for ($i=0; $i < strlen($str); $i++)
-            $hex .= dechex(ord($str[$i]));
-
-        return $hex;
+        return implode(unpack("H*", $str));
     }
 
     /**
-- 
GitLab