cvs: pear /Net_LDAP package2.xml /Net_LDAP/LDAP Schema.php
[email protected] ("Benedikt Hallinger")
| Newsgroups | php.pear.cvs |
|---|---|
| Message-ID | <cvsbeni1209547985@cvsserver> |
beni Wed Apr 30 09:33:05 2008 UTC
Modified files:
/pear/Net_LDAP package2.xml
/pear/Net_LDAP/LDAP Schema.php
Log:
* Backported a patch from Net_LDAP2: Schema->isBinary() did not checked attribute supertypes
http://cvs.php.net/viewvc.cgi/pear/Net_LDAP/package2.xml?r1=1.60&r2=1.61&diff_format=u
Index: pear/Net_LDAP/package2.xml
diff -u pear/Net_LDAP/package2.xml:1.60 pear/Net_LDAP/package2.xml:1.61
--- pear/Net_LDAP/package2.xml:1.60 Wed Mar 19 08:14:00 2008
+++ pear/Net_LDAP/package2.xml Wed Apr 30 09:33:05 2008
@@ -48,6 +48,7 @@
</stability>
<license>LGPL License</license>
<notes>
+ * Backportet a patch from Net_LDAP2. Schema->isBinary() did not checked attribute supertypes
</notes>
<contents>
http://cvs.php.net/viewvc.cgi/pear/Net_LDAP/LDAP/Schema.php?r1=1.20&r2=1.21&diff_format=u
Index: pear/Net_LDAP/LDAP/Schema.php
diff -u pear/Net_LDAP/LDAP/Schema.php:1.20 pear/Net_LDAP/LDAP/Schema.php:1.21
--- pear/Net_LDAP/LDAP/Schema.php:1.20 Wed Oct 24 06:29:32 2007
+++ pear/Net_LDAP/LDAP/Schema.php Wed Apr 30 09:33:05 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.20 2007/10/24 06:29:32 beni Exp $
+* @version CVS: $Id: Schema.php,v 1.21 2008/04/30 09:33:05 beni Exp $
* @link http://pear.php.net/package/Net_LDAP/
*/
class Net_LDAP_Schema extends PEAR
@@ -382,10 +382,13 @@
*
* @param string $attribute The name of the attribute (eg.: 'sn')
*
+ * @access public
* @return boolean
*/
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
@@ -397,12 +400,22 @@
// Check Syntax
$attr_s = $this->get('attribute', $attribute);
if (false === Net_LDAP::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;
}
}
?>
\ No newline at end of file