From 48bf5022e4f67b0718f7b26ed00f89fec4d1cc17 Mon Sep 17 00:00:00 2001
From: Eric Clemmons <eric@smarterspam.com>
Date: Mon, 24 Oct 2011 19:45:23 -0700
Subject: [PATCH] ProxyFactory always checks if directory is writable first

---
 lib/Doctrine/ORM/Proxy/ProxyFactory.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/lib/Doctrine/ORM/Proxy/ProxyFactory.php
index 9436bcb71..aa53a0686 100644
--- a/lib/Doctrine/ORM/Proxy/ProxyFactory.php
+++ b/lib/Doctrine/ORM/Proxy/ProxyFactory.php
@@ -153,7 +153,12 @@ class ProxyFactory
         $file = str_replace($placeholders, $replacements, $file);
 
         $parentDirectory = dirname($fileName);
-        if (! is_dir($parentDirectory) && ! mkdir($parentDirectory, 0775, true)) {
+
+        if (! is_dir($parentDirectory)) {
+            mkdir($parentDirectory, 0775, true);
+        }
+
+        if ( ! is_writable($parentDirectory)) {
             throw ProxyException::proxyDirectoryNotWritable();
         }