Skip to content

Commit

Permalink
* Fixed bug with EQUALS matching
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.php.net/repository/pear/packages/Net_LDAP2/trunk@332286 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
hbeni committed Dec 6, 2013
1 parent f57e757 commit aede842
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Net/LDAP2/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ function matches(&$entries, &$results=array()) {
list($attribute, $match, $assertValue) = $this->getComponents();
switch ($match) {
case '=':
$regexp = '/'.str_replace('*', '.*', $assertValue).'/i'; // not case sensitive unless specified by schema
$regexp = '/^'.str_replace('*', '.*', $assertValue).'$/i'; // not case sensitive unless specified by schema
$entry_matched = $entry->pregMatch($regexp, $attribute);
break;

Expand Down
2 changes: 2 additions & 0 deletions tests/Net_LDAP2_FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ public function testMatch() {
// Simple matching on single entry
$filter = Net_LDAP2_Filter::create('cn', 'equals', 'Simpson Homer');
$this->assertEquals(1, $filter->matches($entry1));
$filter = Net_LDAP2_Filter::create('cn', 'equals', 'son');
$this->assertEquals(0, $filter->matches($entry1));

$filter = Net_LDAP2_Filter::create('mail', 'begins', 'Hom');
$this->assertEquals(1, $filter->matches($entry1));
Expand Down

0 comments on commit aede842

Please sign in to comment.