With <VirtualHost _default_:*> or <VirtualHost *:*> and Listen 8080 in the global configuration, the CGI variable SERVER_PORT is always passed as 80, although the URI is given as http://hostname:8080/some_cgi_script. This is independent of the setting of UseCanonicalName. If <VirtualHost _default_:8080> or <VirtualHost *:8080> is used, the resulting SERVER_PORT is correct. This bug does not occur with apache-1.3.41. I did not test 2.0.x.
Sorry, I overlooked the new directive UseCanonicalPhysicalPort, which defaults to "off" (thus ignoring the physical port used). If it is set to "on" in the main server or virtual host section, the "bug" does not occur.