Index: bbcode-filter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bbcode/bbcode-filter.inc,v
retrieving revision 1.62
diff -u -p -r1.62 bbcode-filter.inc
--- bbcode-filter.inc	3 Aug 2007 05:38:35 -0000	1.62
+++ bbcode-filter.inc	10 Aug 2007 09:40:56 -0000
@@ -332,7 +332,18 @@ function _bbcode_notag_tag($text = NULL)
 }
 
 function _bbcode_php_tag($text = NULL) {
-  return '<pre>'. highlight_string( str_replace('<br />', '', stripslashes($text)), true) .'</pre>';
+  $text = str_replace('<br />', '', stripslashes($text));
+  // PHP requires special start and end tags for highlighting
+  if (strpos($text, "<?php") === FALSE) {
+    $text = "<?php\n". trim($text) ."\n?>";
+  }
+  $text = highlight_string($text, TRUE);
+  // Make PHP output xhtml compliant
+  $text = str_replace(
+    array( '<font color="', '</font>' ),
+    array( '<span style="color: ', '</span>' ),
+    $text );
+  return '<pre>'. $text .'</pre>';
 }
 
 function _bbcode_round_size_val($size) {
