Index: tinymce.module
===================================================================
--- tinymce.module	(revision 2)
+++ tinymce.module	(working copy)
@@ -731,18 +731,19 @@
 function _tinymce_page_match($edit) {
   $page_match = FALSE;
 
-  // This piece of code sometimes fires on textareas that are just 
-  // plain HTML; so I disabled it. I want my, I want my, I want my MCE....
+  // Kill TinyMCE if we're editing a textarea with PHP in it!
+  if (is_numeric(arg(1)) && arg(2) == 'edit') {
+    $node = node_load(arg(1));
+    // Each format can have multiple filters - we want to skip the one from the
+    // PHP module.
+    $filters = filter_list_format($node->format);
+    foreach ($filters as $filter) {
+      if ($filter->module == 'php') {
+        return FALSE;
+      }
+    }
+  }
 
-//  // Kill TinyMCE if we're editing a textarea with PHP in it!
-//  // PHP input formats are #2 in the filters table.
-//  if (is_numeric(arg(1)) && arg(2) == 'edit') {
-//    $node = node_load(arg(1));
-//    if ($node->format == 2) {
-//      return FALSE;
-//    }
-//  }
-
   if ($edit->settings['access_pages']) {
 	  
     // If the PHP option wasn't selected
