rackspace/php-cloudfiles — pull request #45 by thomseddon (2011-10-15 14:33:37+00:00)
Title: Fixed cfs_http->close()

Firstly, the syntax did not match the close structure:

Syntax:

```php
$this->connections = array( 'PUT' => NULL, ... )
```
(These are then filled with connection resources when avaliable)

Previous close() structure:

```php
foreach ($this->connections as $cnx) {
if (isset($cnx)) {
curl_close($cnx);
$this->connections[$cnx] = NULL;
}
}
```
But the curl resource is stored in the value, not the key?

New close() structure:

```php
foreach ($this->connections as $type => $cnx) {
if(is_resource($cnx)){
curl_close($cnx);
}
$this->connections[$type] = NULL;
}
```

Also, if there is a problem with $cnx (in my case it ended up an integer), curl_close fails, so rather than just checking if it is set, the check is if it is a resource (i.e. can be closed!) and then I just made everything NULL

I feel this is more robust and offers exactly the same functionality as before, but with some enhancement.