Permalink
Browse files

Merge pull request #4 from mvrhov/patch-1

Don't save file over itself when dealing with a local file
  • Loading branch information...
2 parents faafdde + 712e3ab commit 9867330ec11a87c37ac370a024abbfaf85b28504 @GaretJax GaretJax committed Nov 16, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 browscap/Browscap.php
@@ -462,11 +462,12 @@ private function _getRemoteIniFile($url, $path)
$subject = trim($subject);
$content .= preg_replace($pattern, '$1="$2"', $subject) . "\n";
}
-
- if (!file_put_contents($path, $content)) {
- throw new Browscap_Exception("Could not write .ini content to $path");
+
+ if ($url != $path) {
+ if (!file_put_contents($path, $content)) {
+ throw new Browscap_Exception("Could not write .ini content to $path");
+ }
}
-
return true;
}

0 comments on commit 9867330

Please sign in to comment.