From 019d351a6c93280345c1d3ddbb5c3af187ff8eba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Thu, 5 Feb 2009 09:34:14 +0000
Subject: [PATCH] only closing socket when socket exists..

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1240 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/ldapstatus/lib/LDAPTester.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/ldapstatus/lib/LDAPTester.php b/modules/ldapstatus/lib/LDAPTester.php
index 197731bea..afdb46af1 100644
--- a/modules/ldapstatus/lib/LDAPTester.php
+++ b/modules/ldapstatus/lib/LDAPTester.php
@@ -67,7 +67,7 @@ class sspmod_ldapstatus_LDAPTester {
 	
 		$timeout = 1.0;
 		$socket = @fsockopen($host, $port, $errno, $errstr, $timeout);
-		@fclose($socket);
+		if ($socket) @fclose($socket);
 		if ($errno) {
 			return array(FALSE, $errno . ':' . $errstr . ' [' . $host . ':' . $port . ']');
 		} else {		
-- 
GitLab