In response to codegrunt slave, you could suppress any warnings from being output by using the @ symbol.
<?php
@session_name("(bad name)");
?>
Alternatively, you could use output buffering instead of the @ symbol if you wanted to check whether an error occurred.
<?php
ob_start();
session_name("(bad name)");
$Output = ob_get_contents();
ob_end_clean();
if ($Output != "")
print("Bad session name!");
?>