#41223 [NEW]: PHP should output better HTML for the .phps (highlight source) view

From: Date: Sun, 29 Apr 2007 09:22:35 +0000
Subject: #41223 [NEW]: PHP should output better HTML for the .phps (highlight source) view
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112064@lists.php.net to get a copy of this message
From: jeremy dot visser at gmail dot com Operating system: Ubuntu 7.04 PHP version: 5.2.1 PHP Bug Type: Output Control Bug description: PHP should output better HTML for the .phps (highlight source) view Description: ------------ When PHP outputs highlighted source, the HTML it outputs is ugly. It looks pretty when viewed in a browser, but the actual HTML is bad. For starters, it doesn't use a DOCTYPE, and includes no <html>, <head>, or <body> elements like you'd expect. Even worse, it preformats the text not with a <pre> tag like should be used, but with several &nbsp;'s to space text out. What is wrong with using <pre>? Expected result: ---------------- Should be using proper HTML headers: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>test.phps</title> </head> <body> <pre class="php"> &lt;?php /* This is some PHP */ ?&gt; </pre> </body> </html> You see, when you use a <pre>, you don't need all these &nbsp;&nbsp;'s to space things out. Actual result: -------------- Example of ugly code: <span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Test<br />&nbsp;&nbsp;&nbsp;&nbsp;*/<br />?&gt; -- Edit bug report at http://bugs.php.net/?id=41223&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41223&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41223&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41223&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41223&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41223&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41223&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41223&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41223&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41223&r=support Expected behavior: http://bugs.php.net/fix.php?id=41223&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41223&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41223&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41223&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41223&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41223&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41223&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41223&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41223&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41223&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41223&r=mysqlcfg

« previous php.bugs (#112064) next »