Manual merge of !87 Update LDAP2 extlib to 2.2.0 (stable) released on 2015-10-30

Thanks postblue
This commit is contained in:
Mikael Nordfeldth 2016-01-28 13:34:45 +01:00
parent d73c264e25
commit bb0cb9b3f6
10 changed files with 101 additions and 65 deletions

View File

@ -13,7 +13,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2003-2007 Tarjej Huse, Jan Wagner, Del Elson, Benedikt Hallinger * @copyright 2003-2007 Tarjej Huse, Jan Wagner, Del Elson, Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @link http://pear.php.net/package/Net_LDAP2/
*/ */
@ -192,7 +192,7 @@ class Net_LDAP2 extends PEAR
* @access public * @access public
* @return Net_LDAP2_Error|Net_LDAP2 Net_LDAP2_Error or Net_LDAP2 object * @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(); $ldap_check = self::checkLDAPExtension();
if (self::iserror($ldap_check)) { if (self::iserror($ldap_check)) {
@ -229,7 +229,7 @@ class Net_LDAP2 extends PEAR
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->PEAR('Net_LDAP2_Error'); parent::__construct('Net_LDAP2_Error');
$this->setConfig($config); $this->setConfig($config);
} }
@ -665,7 +665,7 @@ class Net_LDAP2 extends PEAR
public function start_tls() public function start_tls()
{ {
$args = func_get_args(); $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, * This also links the entry to the connection used for the add,
* if it was a fresh entry ({@link Net_LDAP2_Entry::createFresh()}) * 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 * @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) { if (!$entry instanceof Net_LDAP2_Entry) {
return PEAR::raiseError('Parameter to Net_LDAP2::add() must be a Net_LDAP2_Entry object.'); 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 * @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 * @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)) { if (!is_array($attr)) {
$attr = array($attr); $attr = array($attr);
@ -1327,7 +1327,7 @@ class Net_LDAP2 extends PEAR
if (is_string($entry)) { if (is_string($entry)) {
$entry_o = $this->getEntry($entry); $entry_o = $this->getEntry($entry);
} else { } else {
$entry_o =& $entry; $entry_o = $entry;
} }
if (!$entry_o instanceof Net_LDAP2_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)'); 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 * Please note that only attributes you have
* selected will be copied. * 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 * @param string $newdn New FQF-DN of the entry
* *
* @return Net_LDAP2_Error|Net_LDAP2_Entry Error Message or reference to the copied 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) { if (!$entry instanceof Net_LDAP2_Entry) {
return PEAR::raiseError('Parameter $entry is expected to be a Net_LDAP2_Entry object!'); 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 * @access public
* @return Net_LDAP2_Error|Net_LDAP2_RootDSE Net_LDAP2_Error or Net_LDAP2_RootDSE object * @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)) { if ($attrs !== null && !is_array($attrs)) {
return PEAR::raiseError('Parameter $attr is expected to be an array!'); 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 // see if we need to fetch a fresh object, or if we already
// requested this object with the same attributes // requested this object with the same attributes
if (true || !array_key_exists($attrs_signature, $this->_rootDSE_cache)) { 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) { if ($rootdse instanceof Net_LDAP2_Error) {
return $rootdse; return $rootdse;
} }
@ -1520,10 +1520,10 @@ class Net_LDAP2 extends PEAR
* @see rootDse() * @see rootDse()
* @return Net_LDAP2_Error|Net_LDAP2_RootDSE * @return Net_LDAP2_Error|Net_LDAP2_RootDSE
*/ */
public function &root_dse() public function root_dse()
{ {
$args = func_get_args(); $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 * @access public
* @return Net_LDAP2_Schema|Net_LDAP2_Error Net_LDAP2_Schema or Net_LDAP2_Error object * @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 // Schema caching by Knut-Olav Hoven
// If a schema caching object is registered, we use that to fetch // If a schema caching object is registered, we use that to fetch
@ -1746,7 +1746,7 @@ class Net_LDAP2 extends PEAR
* @access public * @access public
* @return resource LDAP link * @return resource LDAP link
*/ */
public function &getLink() public function getLink()
{ {
if ($this->_config['auto_reconnect']) { if ($this->_config['auto_reconnect']) {
while (true) { while (true) {
@ -1792,9 +1792,9 @@ class Net_LDAP2_Error extends PEAR_Error
$level = E_USER_NOTICE, $debuginfo = null) $level = E_USER_NOTICE, $debuginfo = null)
{ {
if (is_int($code)) { 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 { } else {
$this->PEAR_Error("$message: $code", NET_LDAP2_ERROR, $mode, $level, $debuginfo); parent::__construct("$message: $code", NET_LDAP2_ERROR, $mode, $level, $debuginfo);
} }
} }
} }

View File

@ -12,7 +12,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Tarjej Huse, Jan Wagner, Benedikt Hallinger * @copyright 2009 Tarjej Huse, Jan Wagner, Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @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()} * You should not call this method manually! Use {@link Net_LDAP2_Entry::createFresh()}
* or {@link Net_LDAP2_Entry::createConnected()} instead! * 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 * @param string|ressource $entry Either a DN or a LDAP-Entry ressource
* *
* @access protected * @access protected
* @return none * @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 // set up entry resource or DN
if (is_resource($entry)) { if (is_resource($entry)) {
$this->_entry = &$entry; $this->_entry = $entry;
} else { } else {
$this->_dn = $entry; $this->_dn = $entry;
} }
// set up LDAP link // set up LDAP link
if ($ldap instanceof Net_LDAP2) { if ($ldap instanceof Net_LDAP2) {
$this->_ldap = &$ldap; $this->_ldap = $ldap;
$this->_link = $ldap->getLink(); $this->_link = $ldap->getLink();
} elseif (is_resource($ldap)) { } elseif (is_resource($ldap)) {
$this->_link = $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)) { if (is_null($attributes) && is_resource($this->_entry) && is_resource($this->_link)) {
// fetch schema // fetch schema
if ($this->_ldap instanceof Net_LDAP2) { if ($this->_ldap instanceof Net_LDAP2) {
$schema =& $this->_ldap->schema(); $schema = $this->_ldap->schema();
} }
// fetch attributes // fetch attributes
$attributes = array(); $attributes = array();
@ -505,7 +505,7 @@ class Net_LDAP2_Entry extends PEAR
public function get_value() public function get_value()
{ {
$args = func_get_args(); $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 // ensure we have a valid LDAP object
$ldap =& $this->getLDAP(); $ldap = $this->getLDAP();
if (!$ldap instanceof Net_LDAP2) { if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("The entries LDAP object is not valid"); return PEAR::raiseError("The entries LDAP object is not valid");
} }
@ -914,7 +914,7 @@ class Net_LDAP2_Entry extends PEAR
* @access public * @access public
* @return Net_LDAP2|Net_LDAP2_Error Reference to the Net_LDAP2 Object (the connection) or Net_LDAP2_Error * @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) { if (!$this->_ldap instanceof Net_LDAP2) {
$err = new PEAR_Error('LDAP is not a valid Net_LDAP2 object'); $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 * After setting a Net_LDAP2 object, calling update() will use that object for
* updating directory contents. Use this to dynamicly switch directorys. * 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 * @access public
* @return true|Net_LDAP2_Error * @return true|Net_LDAP2_Error
*/ */
public function setLDAP(&$ldap) public function setLDAP($ldap)
{ {
if (!$ldap instanceof Net_LDAP2) { if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("LDAP is not a valid Net_LDAP2 object"); return PEAR::raiseError("LDAP is not a valid Net_LDAP2 object");
} else { } else {
$this->_ldap =& $ldap; $this->_ldap = $ldap;
return true; return true;
} }
} }
@ -981,7 +981,7 @@ class Net_LDAP2_Entry extends PEAR
* *
* Usage example: * Usage example:
* <code> * <code>
* $result = $entry->preg_match('/089(\d+)/', 'telephoneNumber', &$matches); * $result = $entry->preg_match('/089(\d+)/', 'telephoneNumber', $matches);
* if ( $result === true ){ * if ( $result === true ){
* echo "First match: ".$matches[0][1]; // Match of value 1, content of first bracket * echo "First match: ".$matches[0][1]; // Match of value 1, content of first bracket
* } else { * } else {
@ -1032,7 +1032,7 @@ class Net_LDAP2_Entry extends PEAR
public function preg_match() public function preg_match()
{ {
$args = func_get_args(); $args = func_get_args();
return call_user_func_array(array( &$this, 'pregMatch' ), $args); return call_user_func_array(array( $this, 'pregMatch' ), $args);
} }
/** /**

View File

@ -10,7 +10,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Benedikt Hallinger * @copyright 2009 Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @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 * @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(); $leaf_filter = new Net_LDAP2_Filter();
if ($escape) { if ($escape) {

View File

@ -10,7 +10,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Benedikt Hallinger * @copyright 2009 Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @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()) 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 // First, parse options
// todo: maybe implement further checks on possible values // todo: maybe implement further checks on possible values

View File

@ -10,7 +10,7 @@
* @author Jan Wagner <wagner@netsols.de> * @author Jan Wagner <wagner@netsols.de>
* @copyright 2009 Jan Wagner * @copyright 2009 Jan Wagner
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @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 * @param Net_LDAP2_Entry &$entry Net_LDAP2_Entry object of the RootDSE
*/ */
protected function __construct(&$entry) public function __construct(&$entry)
{ {
$this->_entry = $entry; $this->_entry = $entry;
} }

View File

@ -11,7 +11,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Jan Wagner, Benedikt Hallinger * @copyright 2009 Jan Wagner, Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @link http://pear.php.net/package/Net_LDAP2/
* @todo see the comment at the end of the file * @todo see the comment at the end of the file
*/ */
@ -109,9 +109,9 @@ class Net_LDAP2_Schema extends PEAR
* *
* @access protected * @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 * @access public
* @return Net_LDAP2_Schema|NET_LDAP2_Error * @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) { if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("Unable to fetch Schema: Parameter \$ldap must be a Net_LDAP2 object!"); return PEAR::raiseError("Unable to fetch Schema: Parameter \$ldap must be a Net_LDAP2 object!");

View File

@ -10,7 +10,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Benedikt Hallinger * @copyright 2009 Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @link http://pear.php.net/package/Net_LDAP2/
*/ */

View File

@ -11,7 +11,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Tarjej Huse, Benedikt Hallinger * @copyright 2009 Tarjej Huse, Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @link http://pear.php.net/package/Net_LDAP2/
*/ */
@ -125,20 +125,20 @@ class Net_LDAP2_Search extends PEAR implements Iterator
/** /**
* Constructor * Constructor
* *
* @param resource &$search Search result identifier * @param resource $search Search result identifier
* @param Net_LDAP2|resource &$ldap Net_LDAP2 object or just a LDAP-Link resource * @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}) * @param array $attributes (optional) Array with searched attribute names. (see {@link $_searchedAttrs})
* *
* @access public * @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); $this->setSearch($search);
if ($ldap instanceof Net_LDAP2) { if ($ldap instanceof Net_LDAP2) {
$this->_ldap =& $ldap; $this->_ldap = $ldap;
$this->setLink($this->_ldap->getLink()); $this->setLink($this->_ldap->getLink());
} else { } else {
$this->setLink($ldap); $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 * @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 (is_null($this->_entry)) {
if(!$this->_entry = @ldap_first_entry($this->_link, $this->_search)) { 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() public function shift_entry()
{ {
$args = func_get_args(); $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() public function pop_entry()
{ {
$args = func_get_args(); $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 * Set the search objects resource link
* *
* @param resource &$search Search result identifier * @param resource $search Search result identifier
* *
* @access public * @access public
* @return void * @return void
*/ */
public function setSearch(&$search) public function setSearch($search)
{ {
$this->_search = $search; $this->_search = $search;
} }
@ -451,12 +451,12 @@ class Net_LDAP2_Search extends PEAR implements Iterator
/** /**
* Set the ldap ressource link * Set the ldap ressource link
* *
* @param resource &$link Link identifier * @param resource $link Link identifier
* *
* @access public * @access public
* @return void * @return void
*/ */
public function setLink(&$link) public function setLink($link)
{ {
$this->_link = $link; $this->_link = $link;
} }

View File

@ -10,7 +10,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Benedikt Hallinger * @copyright 2009 Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @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 * @param array $cfg Config array
*/ */
public function Net_LDAP2_SimpleFileSchemaCache($cfg) public function __construct($cfg)
{ {
foreach ($cfg as $key => $value) { foreach ($cfg as $key => $value) {
if (array_key_exists($key, $this->config)) { if (array_key_exists($key, $this->config)) {

View File

@ -10,7 +10,7 @@
* @author Benedikt Hallinger <beni@php.net> * @author Benedikt Hallinger <beni@php.net>
* @copyright 2009 Benedikt Hallinger * @copyright 2009 Benedikt Hallinger
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3 * @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/ * @link http://pear.php.net/package/Net_LDAP2/
*/ */
@ -113,8 +113,23 @@ class Net_LDAP2_Util extends PEAR
// MV RDN! // MV RDN!
foreach ($rdns as $subrdn_k => $subrdn_v) { foreach ($rdns as $subrdn_k => $subrdn_v) {
// Casefolding // Casefolding
if ($options['casefold'] == 'upper') $subrdn_v = preg_replace("/^(\w+=)/e", "''.strtoupper('\\1').''", $subrdn_v); if ($options['casefold'] == 'upper') {
if ($options['casefold'] == 'lower') $subrdn_v = preg_replace("/^(\w+=)/e", "''.strtolower('\\1').''", $subrdn_v); $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']) { if ($options['onlyvalues']) {
preg_match('/(.+?)(?<!\\\\)=(.+)/', $subrdn_v, $matches); preg_match('/(.+?)(?<!\\\\)=(.+)/', $subrdn_v, $matches);
@ -133,8 +148,23 @@ class Net_LDAP2_Util extends PEAR
// normal RDN // normal RDN
// Casefolding // Casefolding
if ($options['casefold'] == 'upper') $value = preg_replace("/^(\w+=)/e", "''.strtoupper('\\1').''", $value); if ($options['casefold'] == 'upper') {
if ($options['casefold'] == 'lower') $value = preg_replace("/^(\w+=)/e", "''.strtolower('\\1').''", $value); $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']) { if ($options['onlyvalues']) {
preg_match('/(.+?)(?<!\\\\)=(.+)/', $value, $matches); preg_match('/(.+?)(?<!\\\\)=(.+)/', $value, $matches);
@ -484,7 +514,13 @@ class Net_LDAP2_Util extends PEAR
*/ */
public static function hex2asc($string) 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; return $string;
} }