Pārlūkot izejas kodu

fixed issue when trying to retrieve a node by DN which doesn't exist
removed unnecessary test

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18877 44c647ce-9c0f-0410-b52a-842ac1e357ba

sgehrig 16 gadi atpakaļ
vecāks
revīzija
a0d6a9f022

+ 1 - 1
library/Zend/Ldap.php

@@ -1415,7 +1415,7 @@ class Zend_Ldap
      * Returns the specified DN as a Zend_Ldap_Node
      *
      * @param  string|Zend_Ldap_Dn $dn
-     * @return Zend_Ldap_Node
+     * @return Zend_Ldap_Node|null
      * @throws Zend_Ldap_Exception
      */
     public function getNode($dn)

+ 4 - 1
library/Zend/Ldap/Node.php

@@ -258,7 +258,7 @@ class Zend_Ldap_Node extends Zend_Ldap_Node_Abstract implements Iterator, Recurs
      *
      * @param  string|array|Zend_Ldap_Dn $dn
      * @param  Zend_Ldap                 $ldap
-     * @return Zend_Ldap_Node
+     * @return Zend_Ldap_Node|null
      * @throws Zend_Ldap_Exception
      */
     public static function fromLdap($dn, Zend_Ldap $ldap)
@@ -275,6 +275,9 @@ class Zend_Ldap_Node extends Zend_Ldap_Node_Abstract implements Iterator, Recurs
             throw new Zend_Ldap_Exception(null, '$dn is of a wrong data type.');
         }
         $data = $ldap->getEntry($dn, array('*', '+'), true);
+        if ($data === null) {
+            return null;
+        }
         $entry = new self($dn, $data, true, $ldap);
         return $entry;
     }

+ 0 - 14
tests/Zend/Auth/Adapter/Ldap/OnlineTest.php

@@ -209,18 +209,4 @@ class Zend_Auth_Adapter_Ldap_OnlineTest extends PHPUnit_Framework_TestCase
         $this->assertType('stdClass', $account);
         $this->assertFalse(isset($account->userpassword));
     }
-
-    /**
-     * @group ZF-8230
-     */
-    public function testIfLdapAdapterIsBoundWithAuthenticatedCredentials()
-    {
-        $adapter = new Zend_Auth_Adapter_Ldap(
-            array($this->_options),
-            TESTS_ZEND_LDAP_ALT_USERNAME,
-            TESTS_ZEND_LDAP_ALT_PASSWORD
-        );
-
-        $result = $adapter->authenticate();
-    }
 }