This is a bug because of two reasons:

1) There are no longer the "DO NOT CHANGE THE LINE BELOW" and "DO NOT CHANGE THE LINE ABOVE" lines in UBBthreads 7.7:
Code
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF

EOF;

2) It will try to fix the code only if you edit the custom island (editcustomisland.php) but there are not any attempts to fix the code while updating the island with doeditcustomisland.php. So basically, you can publish any broken code you want with doeditcustomisland.php.

A possible solution:

Replace the entire code that cause this problem (editcustomisland.php):
PHP Code
$boxfd = file("{$config['FULL_PATH']}/cache_builders/custom/portal_box_$portal_id.php");
$portal_body = "";
$eof_found = false;
foreach ($boxfd as $linenum => $line) {
	$line = rtrim($line);
	if ($line == "<?php") continue;
	if ($line == "?>" && $eof_found) continue;
	if ($line == "EOF;") $eof_found = true;
	$line = ubbchars($line);
	$portal_body .= "$line\n";
}

$portal_body = trim($portal_body); 

with:
PHP Code
$boxfd = file_get_contents("{$config['FULL_PATH']}/cache_builders/custom/portal_box_$portal_id.php");
$portal_body = ubbchars( str_replace( array( "<?php\n", "?>" ), "", trim($boxfd) ) ); 
So it will no longer try to "fix" the code there

Then add a basic check for $body in doeditcustomisland.php after:
PHP Code
$admin->doAuth(); 
The following code will check for $body = <<<BODY and automatically close it if EOF; is missing. It will also reformat the code if $body is missing:
PHP Code
if( strpos( $portal_body, "\$body = <<<EOF" ) and ( !strpos( $portal_body, "EOF;" ) ) ) $portal_body .= "\nEOF;\n";
if( strpos( $portal_body, "\$body" ) === false ) $portal_body = "/* PHP CODE HERE */\n\n/* BODY HERE */\n\$body = <<<EOF\n" . $portal_body . "\nEOF;\n";