I've never heard of such a bug, so I attempted to reproduce it and failed. This suggests that you have misdiagnosed the problem, or at least haven't provided enough information about it.
I tested with Firefox 3.5 and the following code.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Test of getElementById with named anchors</title>
<h1>Test of getElementById with named anchors</h1>
<h2><a name="one" id="one">First section</a></h2>
<p>The quick brown fox</p>
<h2><a name="two" id="second">Second section</a></h2>
<p>The quick brown fox</p>
<script type="text/javascript">
if (document.getElementById('one')) {
document.write("<p>First section found - id matches name<\/p>");
}
if (document.getElementById('second')) {
document.write("<p>Second section found - id does not match name<\/p>");
}
</script>