|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30456 Livedocs malforms example code
Submitted: 2004-10-16 07:05 UTC Modified: 2005-02-09 20:04 UTC
From: Assigned: ilia (profile)
Status: Closed Package: Livedocs problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2004-10-16 07:05 UTC]
Livedocs, when displaying programlistings, doesn't preserve whitespace properly.

The <code> element doesn't preserve whitespace, and the `preserve-whitespace: pre` line is commented out in the theme's css files.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-16 21:03 UTC]
Can you please give an example page that doesn't work?

If I remember well, Ilia has applied one of my patches a while ago that fixed this.
 [2004-10-17 04:48 UTC]

Look at the docblock, the first space is truncated. All the programlistings have 3 spaces for the first indent, though 4 are in the code.
 [2004-10-17 06:25 UTC]
here is a patch to fix the white space issue:
 [2004-10-17 12:48 UTC]
Sorry for my stupidity, but I couldn't find where the problem is... and nor how the patch would fix the problem.

The patch will also create a bigger page (by replacing ' &nbsp;' with two &nbsp;)
 [2004-10-19 05:08 UTC]
Whitespce in any element which hasn't set preserve to true will be ignored in most circumstances. Using &nbsp; won't be ignored, or setting preserve-whitespace in the CSS. Then you can not use &nbsp; at all.
 [2004-10-19 06:03 UTC]

You might be seing my changes I made for the patch. The problem is that hightlight_string() doesn't put &nbsp; in all places where a space occurs, causing in some places a ' ' to get compressed thus loosing indententation.

Here is an example of the white space compression (example Extending the Exception class):

  1) indentation in actual code is four spaces. this only produces 3.
  2) the  comments withing /* */ get malformed.

CSS might be able to fix this problem, I'll look into instead of translating all spaces to &nbsp;  I'm not sure exactly why the original translations of '\n ' to '<br>&nbsp;' was there but I'm assuming its due to the behaviour of highlight_string().

 [2005-02-09 20:04 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC