cvs: pear /Net_LDAP2/LDAP2 Schema.php
[email protected] ("Benedikt Hallinger")
| Newsgroups | php.pear.cvs |
|---|---|
| Message-ID | <cvsbeni1209547555@cvsserver> |
beni Wed Apr 30 09:25:55 2008 UTC
Modified files:
/pear/Net_LDAP2/LDAP2 Schema.php
Log:
* Applied and modified patch for Bug #13711 (isBinary didnt check supertypes)
http://cvs.php.net/viewvc.cgi/pear/Net_LDAP2/LDAP2/Schema.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/Net_LDAP2/LDAP2/Schema.php
diff -u pear/Net_LDAP2/LDAP2/Schema.php:1.4 pear/Net_LDAP2/LDAP2/Schema.php:1.5
--- pear/Net_LDAP2/LDAP2/Schema.php:1.4 Mon Apr 21 05:52:35 2008
+++ pear/Net_LDAP2/LDAP2/Schema.php Wed Apr 30 09:25:55 2008
@@ -31,7 +31,7 @@
* @author Jan Wagner <[email protected]>
* @author Benedikt Hallinger <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html LGPL
-* @version CVS: $Id: Schema.php,v 1.4 2008/04/21 05:52:35 beni Exp $
+* @version CVS: $Id: Schema.php,v 1.5 2008/04/30 09:25:55 beni Exp $
* @link http://pear.php.net/package/Net_LDAP22/
*/
class Net_LDAP2_Schema extends PEAR
@@ -460,6 +460,8 @@
*/
public function isBinary($attribute)
{
+ $return = false; // default to false
+
// This list contains all syntax that should be treaten as
// containing binary values
// The Syntax Definitons go into constants at the top of this page
@@ -471,12 +473,22 @@
// Check Syntax
$attr_s = $this->get('attribute', $attribute);
if (false === Net_LDAP2::isError($attr_s) && isset($attr_s['syntax']) && in_array($attr_s['syntax'], $syntax_binary)) {
+ // Syntax is defined as binary in schema
$return = true;
- return $return;
} else {
- $return = false;
- return $return;
+ // Syntax not defined as binary, or not found
+ // if attribute is a subtype, check superior attribute syntaxes
+ if (isset($attr_s['sup'])) {
+ foreach ($attr_s['sup'] as $superattr) {
+ $return = $this->isBinary($superattr);
+ if ($return) {
+ break; // stop checking parents since we are binary
+ }
+ }
+ }
}
+
+ return $return;
}
// [TODO] add method that allows us to see to which objectclasses a certain attribute belongs to