diff --git a/Lib/php/director.swg b/Lib/php/director.swg
index 218a84e..9aaf5e7 100644
--- a/Lib/php/director.swg
+++ b/Lib/php/director.swg
@@ -106,7 +106,7 @@ namespace Swig {
       Director(zval* self) : swig_self(self) {
       }
 
-      bool swig_is_overridden_method(char *cname, char *lc_fname) {
+      bool swig_is_overridden_method(char *cname, char *lc_fname TSRMLS_DC) {
         zend_class_entry **ce;
         zend_function *mptr;
         int name_len = strlen(lc_fname);
@@ -135,7 +135,7 @@ namespace Swig {
   protected:
     std::string swig_msg;
   public:
-    DirectorException(int code, const char *hdr, const char* msg)
+    DirectorException(int code, const char *hdr, const char* msg TSRMLS_DC)
       : swig_msg(hdr)
     {
       if (strlen(msg)) {
@@ -146,9 +146,9 @@ namespace Swig {
       SWIG_ErrorMsg() = swig_msg.c_str();
     }
 
-    static void raise(int code, const char *hdr, const char* msg) 
+    static void raise(int code, const char *hdr, const char* msg TSRMLS_DC)
     {
-      throw DirectorException(code, hdr, msg);
+      throw DirectorException(code, hdr, msg TSRMLS_CC);
     }
   };
 
@@ -156,32 +156,34 @@ namespace Swig {
   class DirectorPureVirtualException : public Swig::DirectorException
   {
   public:
-    DirectorPureVirtualException(const char* msg) 
-      : DirectorException(E_ERROR, "SWIG director pure virtual method called", msg)
-    { 
+    DirectorPureVirtualException(const char* msg TSRMLS_DC)
+      : DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC)
+    {
     }
 
-    static void raise(const char *msg) 
+    static void raise(const char *msg TSRMLS_DC)
     {
-      throw DirectorPureVirtualException(msg);
+      throw DirectorPureVirtualException(msg TSRMLS_CC);
     }
   };
   /* any php exception that occurs during a director method call */
   class DirectorMethodException : public Swig::DirectorException
   {
   public:
-    DirectorMethodException(const char* msg = "") 
-      : DirectorException(E_ERROR, "SWIG director method error", msg)
-    { 
+    DirectorMethodException(const char* msg TSRMLS_DC)
+      : DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC)
+    {
     }
 
-    static void raise(const char *msg) 
+    static void raise(const char *msg TSRMLS_DC)
     {
-      throw DirectorMethodException(msg);
+      throw DirectorMethodException(msg TSRMLS_CC);
     }
   };
 }
 
+#define DirectorMethodException() DirectorMethodException("" TSRMLS_CC)
+
 #endif /* __cplusplus */
 
 #endif
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
index b4af248..6bbe12b 100644
--- a/Source/Modules/php.cxx
+++ b/Source/Modules/php.cxx
@@ -806,7 +806,7 @@ public:
       Wrapper_add_local(f, "director", "Swig::Director *director = 0");
       Printf(f->code, "director = dynamic_cast<Swig::Director*>(arg1);\n");
       Wrapper_add_local(f, "upcall", "bool upcall = false");
-      Printf(f->code, "upcall = !director->swig_is_overridden_method((char *)\"%s%s\", (char *)\"%s\");\n",
+      Printf(f->code, "upcall = !director->swig_is_overridden_method((char *)\"%s%s\", (char *)\"%s\" TSRMLS_CC);\n",
 	  prefix, Swig_class_name(Swig_methodclass(n)), name);
     }
 
@@ -2494,7 +2494,7 @@ done:
 	Printf(w->code, "%s;\n", super_call);
 	Delete(super_call);
       } else {
-	Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"Attempted to invoke pure virtual method %s::%s\");\n", SwigType_namestr(c_classname),
+	Printf(w->code, "Swig::DirectorPureVirtualException::raise(\"Attempted to invoke pure virtual method %s::%s\" TSRMLS_CC);\n", SwigType_namestr(c_classname),
 	    SwigType_namestr(name));
       }
     } else {
