]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Manual merge of !87 Update LDAP2 extlib to 2.2.0 (stable) released on 2015-10-30
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 28 Jan 2016 12:34:45 +0000 (13:34 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 28 Jan 2016 12:35:23 +0000 (13:35 +0100)
Thanks postblue

plugins/LdapCommon/extlib/Net/LDAP2.php
plugins/LdapCommon/extlib/Net/LDAP2/Entry.php
plugins/LdapCommon/extlib/Net/LDAP2/Filter.php
plugins/LdapCommon/extlib/Net/LDAP2/LDIF.php
plugins/LdapCommon/extlib/Net/LDAP2/RootDSE.php
plugins/LdapCommon/extlib/Net/LDAP2/Schema.php
plugins/LdapCommon/extlib/Net/LDAP2/SchemaCache.interface.php
plugins/LdapCommon/extlib/Net/LDAP2/Search.php
plugins/LdapCommon/extlib/Net/LDAP2/SimpleFileSchemaCache.php
plugins/LdapCommon/extlib/Net/LDAP2/Util.php

index 1ad1cf334526899c7a0ac9c02f4076dfd03576ef..14966ef2b5adfa4691a92485567832efe34aa3ed 100644 (file)
@@ -13,7 +13,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2003-2007 Tarjej Huse, Jan Wagner, Del Elson, Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: LDAP2.php 332308 2013-12-09 09:15:47Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -192,7 +192,7 @@ class Net_LDAP2 extends PEAR
     * @access public
     * @return Net_LDAP2_Error|Net_LDAP2   Net_LDAP2_Error or Net_LDAP2 object
     */
-    public static function &connect($config = array())
+    public static function connect($config = array())
     {
         $ldap_check = self::checkLDAPExtension();
         if (self::iserror($ldap_check)) {
@@ -229,7 +229,7 @@ class Net_LDAP2 extends PEAR
     */
     public function __construct($config = array())
     {
-        $this->PEAR('Net_LDAP2_Error');
+        parent::__construct('Net_LDAP2_Error');
         $this->setConfig($config);
     }
 
@@ -665,7 +665,7 @@ class Net_LDAP2 extends PEAR
     public function start_tls()
     {
         $args = func_get_args();
-        return call_user_func_array(array( &$this, 'startTLS' ), $args);
+        return call_user_func_array(array( $this, 'startTLS' ), $args);
     }
 
     /**
@@ -708,11 +708,11 @@ class Net_LDAP2 extends PEAR
     * This also links the entry to the connection used for the add,
     * if it was a fresh entry ({@link Net_LDAP2_Entry::createFresh()})
     *
-    * @param Net_LDAP2_Entry &$entry Net_LDAP2_Entry
+    * @param Net_LDAP2_Entry $entry Net_LDAP2_Entry
     *
     * @return Net_LDAP2_Error|true    Net_LDAP2_Error object or true
     */
-    public function add(&$entry)
+    public function add($entry)
     {
         if (!$entry instanceof Net_LDAP2_Entry) {
             return PEAR::raiseError('Parameter to Net_LDAP2::add() must be a Net_LDAP2_Entry object.');
@@ -1283,7 +1283,7 @@ class Net_LDAP2 extends PEAR
     * @return Net_LDAP2_Entry|Net_LDAP2_Error    Reference to a Net_LDAP2_Entry object or Net_LDAP2_Error object
     * @todo Maybe check against the shema should be done to be sure the attribute type exists
     */
-    public function &getEntry($dn, $attr = array())
+    public function getEntry($dn, $attr = array())
     {
         if (!is_array($attr)) {
             $attr = array($attr);
@@ -1327,7 +1327,7 @@ class Net_LDAP2 extends PEAR
         if (is_string($entry)) {
             $entry_o = $this->getEntry($entry);
         } else {
-            $entry_o =& $entry;
+            $entry_o = $entry;
         }
         if (!$entry_o instanceof Net_LDAP2_Entry) {
             return PEAR::raiseError('Parameter $entry is expected to be a Net_LDAP2_Entry object! (If DN was passed, conversion failed)');
@@ -1374,12 +1374,12 @@ class Net_LDAP2 extends PEAR
     * Please note that only attributes you have
     * selected will be copied.
     *
-    * @param Net_LDAP2_Entry &$entry Entry object
+    * @param Net_LDAP2_Entry $entry Entry object
     * @param string          $newdn  New FQF-DN of the entry
     *
     * @return Net_LDAP2_Error|Net_LDAP2_Entry Error Message or reference to the copied entry
     */
-    public function &copy(&$entry, $newdn)
+    public function copy($entry, $newdn)
     {
         if (!$entry instanceof Net_LDAP2_Entry) {
             return PEAR::raiseError('Parameter $entry is expected to be a Net_LDAP2_Entry object!');
@@ -1491,7 +1491,7 @@ class Net_LDAP2 extends PEAR
     * @access public
     * @return Net_LDAP2_Error|Net_LDAP2_RootDSE Net_LDAP2_Error or Net_LDAP2_RootDSE object
     */
-    public function &rootDse($attrs = null)
+    public function rootDse($attrs = null)
     {
         if ($attrs !== null && !is_array($attrs)) {
             return PEAR::raiseError('Parameter $attr is expected to be an array!');
@@ -1502,7 +1502,7 @@ class Net_LDAP2 extends PEAR
         // see if we need to fetch a fresh object, or if we already
         // requested this object with the same attributes
         if (true || !array_key_exists($attrs_signature, $this->_rootDSE_cache)) {
-            $rootdse =& Net_LDAP2_RootDSE::fetch($this, $attrs);
+            $rootdse = Net_LDAP2_RootDSE::fetch($this, $attrs);
             if ($rootdse instanceof Net_LDAP2_Error) {
                 return $rootdse;
             }
@@ -1520,10 +1520,10 @@ class Net_LDAP2 extends PEAR
     * @see rootDse()
     * @return Net_LDAP2_Error|Net_LDAP2_RootDSE
     */
-    public function &root_dse()
+    public function root_dse()
     {
         $args = func_get_args();
-        return call_user_func_array(array(&$this, 'rootDse'), $args);
+        return call_user_func_array(array($this, 'rootDse'), $args);
     }
 
     /**
@@ -1534,7 +1534,7 @@ class Net_LDAP2 extends PEAR
     * @access public
     * @return Net_LDAP2_Schema|Net_LDAP2_Error  Net_LDAP2_Schema or Net_LDAP2_Error object
     */
-    public function &schema($dn = null)
+    public function schema($dn = null)
     {
         // Schema caching by Knut-Olav Hoven
         // If a schema caching object is registered, we use that to fetch
@@ -1746,7 +1746,7 @@ class Net_LDAP2 extends PEAR
     * @access public
     * @return resource LDAP link
     */
-    public function &getLink()
+    public function getLink()
     {
         if ($this->_config['auto_reconnect']) {
             while (true) {
@@ -1792,9 +1792,9 @@ class Net_LDAP2_Error extends PEAR_Error
                          $level = E_USER_NOTICE, $debuginfo = null)
     {
         if (is_int($code)) {
-            $this->PEAR_Error($message . ': ' . Net_LDAP2::errorMessage($code), $code, $mode, $level, $debuginfo);
+            parent::__construct($message . ': ' . Net_LDAP2::errorMessage($code), $code, $mode, $level, $debuginfo);
         } else {
-            $this->PEAR_Error("$message: $code", NET_LDAP2_ERROR, $mode, $level, $debuginfo);
+            parent::__construct("$message: $code", NET_LDAP2_ERROR, $mode, $level, $debuginfo);
         }
     }
 }
index cdbd70136a30cdabdad248aeb9336cf85c7ecd91..a48f822191643bc273cca9687c45e1232e0298b7 100644 (file)
@@ -12,7 +12,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Tarjej Huse, Jan Wagner, Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: Entry.php 332301 2013-12-09 08:17:14Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -140,26 +140,26 @@ class Net_LDAP2_Entry extends PEAR
     * You should not call this method manually! Use {@link Net_LDAP2_Entry::createFresh()}
     * or {@link Net_LDAP2_Entry::createConnected()} instead!
     *
-    * @param Net_LDAP2|ressource|array &$ldap Net_LDAP2 object, ldap-link ressource or array of attributes
+    * @param Net_LDAP2|ressource|array $ldap Net_LDAP2 object, ldap-link ressource or array of attributes
     * @param string|ressource          $entry Either a DN or a LDAP-Entry ressource
     *
     * @access protected
     * @return none
     */
-    protected function __construct(&$ldap, $entry = null)
+    public function __construct($ldap, $entry = null)
     {
-        $this->PEAR('Net_LDAP2_Error');
+        parent::__construct('Net_LDAP2_Error');
 
         // set up entry resource or DN
         if (is_resource($entry)) {
-            $this->_entry = &$entry;
+            $this->_entry = $entry;
         } else {
             $this->_dn = $entry;
         }
 
         // set up LDAP link
         if ($ldap instanceof Net_LDAP2) {
-            $this->_ldap = &$ldap;
+            $this->_ldap = $ldap;
             $this->_link = $ldap->getLink();
         } elseif (is_resource($ldap)) {
             $this->_link = $ldap;
@@ -357,7 +357,7 @@ class Net_LDAP2_Entry extends PEAR
         if (is_null($attributes) && is_resource($this->_entry) && is_resource($this->_link)) {
             // fetch schema
             if ($this->_ldap instanceof Net_LDAP2) {
-                $schema =& $this->_ldap->schema();
+                $schema = $this->_ldap->schema();
             }
             // fetch attributes
             $attributes = array();
@@ -505,7 +505,7 @@ class Net_LDAP2_Entry extends PEAR
     public function get_value()
     {
         $args = func_get_args();
-        return call_user_func_array(array( &$this, 'getValue' ), $args);
+        return call_user_func_array(array( $this, 'getValue' ), $args);
     }
 
     /**
@@ -761,7 +761,7 @@ class Net_LDAP2_Entry extends PEAR
         }
 
         // ensure we have a valid LDAP object
-        $ldap =& $this->getLDAP();
+        $ldap = $this->getLDAP();
         if (!$ldap instanceof Net_LDAP2) {
             return PEAR::raiseError("The entries LDAP object is not valid");
         }
@@ -914,7 +914,7 @@ class Net_LDAP2_Entry extends PEAR
     * @access public
     * @return Net_LDAP2|Net_LDAP2_Error   Reference to the Net_LDAP2 Object (the connection) or Net_LDAP2_Error
     */
-    public function &getLDAP()
+    public function getLDAP()
     {
         if (!$this->_ldap instanceof Net_LDAP2) {
             $err = new PEAR_Error('LDAP is not a valid Net_LDAP2 object');
@@ -930,17 +930,17 @@ class Net_LDAP2_Entry extends PEAR
     * After setting a Net_LDAP2 object, calling update() will use that object for
     * updating directory contents. Use this to dynamicly switch directorys.
     *
-    * @param Net_LDAP2 &$ldap Net_LDAP2 object that this entry should be connected to
+    * @param Net_LDAP2 $ldap Net_LDAP2 object that this entry should be connected to
     *
     * @access public
     * @return true|Net_LDAP2_Error
     */
-    public function setLDAP(&$ldap)
+    public function setLDAP($ldap)
     {
         if (!$ldap instanceof Net_LDAP2) {
             return PEAR::raiseError("LDAP is not a valid Net_LDAP2 object");
         } else {
-            $this->_ldap =& $ldap;
+            $this->_ldap = $ldap;
             return true;
         }
     }
@@ -981,7 +981,7 @@ class Net_LDAP2_Entry extends PEAR
     *
     * Usage example:
     * <code>
-    * $result = $entry->preg_match('/089(\d+)/', 'telephoneNumber', &$matches);
+    * $result = $entry->preg_match('/089(\d+)/', 'telephoneNumber', $matches);
     * if ( $result === true ){
     *     echo "First match: ".$matches[0][1];   // Match of value 1, content of first bracket
     * } else {
@@ -1032,7 +1032,7 @@ class Net_LDAP2_Entry extends PEAR
     public function preg_match()
     {
         $args = func_get_args();
-        return call_user_func_array(array( &$this, 'pregMatch' ), $args);
+        return call_user_func_array(array( $this, 'pregMatch' ), $args);
     }
 
     /**
index 557fc892e35c9eb296277a08d573d34ccf5f8c0e..646cf9006925d3f6233b1c2d918c0acf055ec425 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: Filter.php 332305 2013-12-09 08:51:41Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -161,7 +161,7 @@ class Net_LDAP2_Filter extends PEAR
     *
     * @return Net_LDAP2_Filter|Net_LDAP2_Error
     */
-    public static function &create($attr_name, $match, $value = '', $escape = true)
+    public static function create($attr_name, $match, $value = '', $escape = true)
     {
         $leaf_filter = new Net_LDAP2_Filter();
         if ($escape) {
index 384b8e2b797fab542d8a54b4e2abe68839ab297a..250e2488c5844545da56e9789d144793b1e8036d 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: LDIF.php 324918 2012-04-06 12:31:04Z clockwerx $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -218,7 +218,7 @@ class Net_LDAP2_LDIF extends PEAR
     */
     public function __construct($file, $mode = 'r', $options = array())
     {
-        $this->PEAR('Net_LDAP2_Error'); // default error class
+        parent::__construct('Net_LDAP2_Error'); // default error class
 
         // First, parse options
         // todo: maybe implement further checks on possible values
index 8dc81fd4f1958093b909661615a11859fbca96dd..0693d95672e97500df3149105b2ac4d83db6e6b9 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Jan Wagner <wagner@netsols.de>
 * @copyright 2009 Jan Wagner
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: RootDSE.php 286718 2009-08-03 07:30:49Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -41,7 +41,7 @@ class Net_LDAP2_RootDSE extends PEAR
     *
     * @param Net_LDAP2_Entry &$entry Net_LDAP2_Entry object of the RootDSE
     */
-    protected function __construct(&$entry)
+    public function __construct(&$entry)
     {
         $this->_entry = $entry;
     }
index 7eb15662eb442a710588056b4e6f349426b9cfb0..3b090d39960a2e8ae74df15cadee934fcb734fe4 100644 (file)
@@ -11,7 +11,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Jan Wagner, Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: Schema.php 296515 2010-03-22 14:46:41Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 * @todo see the comment at the end of the file
 */
@@ -109,9 +109,9 @@ class Net_LDAP2_Schema extends PEAR
     *
     * @access protected
     */
-    protected function __construct()
+    public function __construct()
     {
-        $this->PEAR('Net_LDAP2_Error'); // default error class
+        parent::__construct('Net_LDAP2_Error'); // default error class
     }
 
     /**
@@ -123,7 +123,7 @@ class Net_LDAP2_Schema extends PEAR
     * @access public
     * @return Net_LDAP2_Schema|NET_LDAP2_Error
     */
-    public function fetch($ldap, $dn = null)
+    public static function fetch($ldap, $dn = null)
     {
         if (!$ldap instanceof Net_LDAP2) {
             return PEAR::raiseError("Unable to fetch Schema: Parameter \$ldap must be a Net_LDAP2 object!");
index e0c3094c4cf018011febc54fa73d682e00d3c0a1..b5f9ea4460a83e8fd1fdc81f3457146db7d426b1 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: SchemaCache.interface.php 286718 2009-08-03 07:30:49Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
index d18554f5784114cecafb9fce6a040a652a85f3df..f91681b7c70897200e0bfb476d7adf8a40264723 100644 (file)
@@ -11,7 +11,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Tarjej Huse, Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: Search.php 328961 2013-01-03 09:04:30Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -125,20 +125,20 @@ class Net_LDAP2_Search extends PEAR implements Iterator
     /**
     * Constructor
     *
-    * @param resource           &$search    Search result identifier
-    * @param Net_LDAP2|resource &$ldap      Net_LDAP2 object or just a LDAP-Link resource
+    * @param resource           $search    Search result identifier
+    * @param Net_LDAP2|resource $ldap      Net_LDAP2 object or just a LDAP-Link resource
     * @param array              $attributes (optional) Array with searched attribute names. (see {@link $_searchedAttrs})
     *
     * @access public
     */
-    public function __construct(&$search, &$ldap, $attributes = array())
+    public function __construct($search, $ldap, $attributes = array())
     {
-        $this->PEAR('Net_LDAP2_Error');
+        parent::__construct('Net_LDAP2_Error');
 
         $this->setSearch($search);
 
         if ($ldap instanceof Net_LDAP2) {
-            $this->_ldap =& $ldap;
+            $this->_ldap = $ldap;
             $this->setLink($this->_ldap->getLink());
         } else {
             $this->setLink($ldap);
@@ -180,7 +180,7 @@ class Net_LDAP2_Search extends PEAR implements Iterator
     *
     * @return Net_LDAP2_Entry|false  Reference to Net_LDAP2_Entry object or false
     */
-    public function &shiftEntry()
+    public function shiftEntry()
     {
         if (is_null($this->_entry)) {
             if(!$this->_entry = @ldap_first_entry($this->_link, $this->_search)) {
@@ -209,7 +209,7 @@ class Net_LDAP2_Search extends PEAR implements Iterator
     public function shift_entry()
     {
         $args = func_get_args();
-        return call_user_func_array(array( &$this, 'shiftEntry' ), $args);
+        return call_user_func_array(array( $this, 'shiftEntry' ), $args);
     }
 
     /**
@@ -240,7 +240,7 @@ class Net_LDAP2_Search extends PEAR implements Iterator
     public function pop_entry()
     {
         $args = func_get_args();
-        return call_user_func_array(array( &$this, 'popEntry' ), $args);
+        return call_user_func_array(array( $this, 'popEntry' ), $args);
     }
 
     /**
@@ -438,12 +438,12 @@ class Net_LDAP2_Search extends PEAR implements Iterator
     /**
     * Set the search objects resource link
     *
-    * @param resource &$search Search result identifier
+    * @param resource $search Search result identifier
     *
     * @access public
     * @return void
     */
-    public function setSearch(&$search)
+    public function setSearch($search)
     {
         $this->_search = $search;
     }
@@ -451,12 +451,12 @@ class Net_LDAP2_Search extends PEAR implements Iterator
     /**
     * Set the ldap ressource link
     *
-    * @param resource &$link Link identifier
+    * @param resource $link Link identifier
     *
     * @access public
     * @return void
     */
-    public function setLink(&$link)
+    public function setLink($link)
     {
         $this->_link = $link;
     }
index 8019654ac8e462d4145efaca5141c8054733ddef..e4eae1533b493f87690201e71022c6da5da67db3 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: SimpleFileSchemaCache.php 286718 2009-08-03 07:30:49Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -43,7 +43,7 @@ class Net_LDAP2_SimpleFileSchemaCache implements Net_LDAP2_SchemaCache
     *
     * @param array $cfg Config array
     */
-    public function Net_LDAP2_SimpleFileSchemaCache($cfg)
+    public function __construct($cfg)
     {
        foreach ($cfg as $key => $value) {
                        if (array_key_exists($key, $this->config)) {
index 9693de2bacfa5a95f7de46fa3f0fbb27aca919cf..87525e6374c37d1b4724cde992caf313cc12b6b2 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: Util.php 332278 2013-12-05 11:01:15Z beni $
+* @version   SVN: $Id$
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -113,8 +113,23 @@ class Net_LDAP2_Util extends PEAR
                 // MV RDN!
                 foreach ($rdns as $subrdn_k => $subrdn_v) {
                     // Casefolding
-                    if ($options['casefold'] == 'upper') $subrdn_v = preg_replace("/^(\w+=)/e", "''.strtoupper('\\1').''", $subrdn_v);
-                    if ($options['casefold'] == 'lower') $subrdn_v = preg_replace("/^(\w+=)/e", "''.strtolower('\\1').''", $subrdn_v);
+                    if ($options['casefold'] == 'upper') {
+                        $subrdn_v = preg_replace_callback(
+                            "/^\w+=/",
+                            function ($matches) {
+                                return strtoupper($matches[0]);
+                            },
+                            $subrdn_v
+                        );
+                    } else if ($options['casefold'] == 'lower') {
+                        $subrdn_v = preg_replace_callback(
+                            "/^\w+=/",
+                            function ($matches) {
+                                return strtolower($matches[0]);
+                            },
+                            $subrdn_v
+                        );
+                    }
 
                     if ($options['onlyvalues']) {
                         preg_match('/(.+?)(?<!\\\\)=(.+)/', $subrdn_v, $matches);
@@ -133,8 +148,23 @@ class Net_LDAP2_Util extends PEAR
                 // normal RDN
 
                 // Casefolding
-                if ($options['casefold'] == 'upper') $value = preg_replace("/^(\w+=)/e", "''.strtoupper('\\1').''", $value);
-                if ($options['casefold'] == 'lower') $value = preg_replace("/^(\w+=)/e", "''.strtolower('\\1').''", $value);
+                if ($options['casefold'] == 'upper') {
+                    $value = preg_replace_callback(
+                        "/^\w+=/",
+                        function ($matches) {
+                            return strtoupper($matches[0]);
+                        },
+                        $value
+                    );
+                } else if ($options['casefold'] == 'lower') {
+                    $value = preg_replace_callback(
+                        "/^\w+=/",
+                        function ($matches) {
+                            return strtolower($matches[0]);
+                        },
+                        $value
+                    );
+                }
 
                 if ($options['onlyvalues']) {
                     preg_match('/(.+?)(?<!\\\\)=(.+)/', $value, $matches);
@@ -484,7 +514,13 @@ class Net_LDAP2_Util extends PEAR
     */
     public static function hex2asc($string)
     {
-        $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
+        $string = preg_replace_callback(
+            "/\\\[0-9A-Fa-f]{2}/",
+            function ($matches) {
+                return chr(hexdec($matches[0]));
+            },
+            $string
+        );
         return $string;
     }