#17 closed defect (fixed)
Code Coverage Reports & instead of &
| Reported by: | norman@… | Owned by: | mrook |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.2.0 |
| Component: | Version: | 2.2.0RC1 | |
| Keywords: | Code Coverage, & | Cc: |
Description
Hi folks,
i saw that in the generated code coverage reports all & will be converted to "& amp ;". That is a good idea, but not if you want an ">" => "&g t ;" => "& amp ;gt;" ...
Thanks in advance
Norman
Attachments (0)
Change History (7)
comment:1 Changed 7 years ago by norman@…
- Priority changed from trivial to minor
comment:2 Changed 7 years ago by mrook
- Owner set to mrook
- Status changed from new to assigned
Hi Norman,
I'm not sure what the problem is. The phrase ">" is only transformed to "&gt;" when the phrase is present in a sourcefile. Symbols such as "<" are correctly converted to "<", not "&lt;".
comment:3 Changed 7 years ago by norman@…
Sorry mrook,
that is simply not true for me. Please take a look at this:
http://opendocumentphp.sourceforge.net/poc/coverage/0.4.6/OpenDocument/AutomaticStyles.html
This report was generated on a Windows XP System, running PHP 5.1.1 and the PHing SVN Trunk (Release Number 49). And you can bet your life on the fact, the we don't have any line like
$this->dom = $dom;
but
$this->dom = $dom;
in our source code. If you need more informations, don't be afraid to ask!
The point is, if you transfer any character of "<",">","&" ... via htmlspecialchars(...) to a &-phrase, you will deliever a new string to utf8_encode which contains a ">" for instands. I don't know if the behaviour of this function has changed , but you can see the results on my system configuration on the link above.
The question is "WHY?": Why do you use both functions in your code?
Yours, Norman
comment:4 Changed 7 years ago by mrook
Hi Norman,
It seems the problem is a little more complex. Apparently DOMDocument->createTextNode() (used in CoverageReportTask::transformSourceFile) escapes output on its own, resulting in &amp; combinations in the coverage.xml temporary file. The XSLT stylesheet *should* have taken care of that, vis-a-vis the three 'disable-output-escaping="yes"' attributes in coverage-frames.xsl.
Apparently, your setup behaves a little different, and does not reduce the &amp; to &. My setup continues to work correctly when I remove the htmlspecialchars() call in CoverageReportTask, and remove the disable-output-escaping attributes in coverage-frames.xsl.
Can you perform this change locally and confirm this works on your setup?
Thanks,
Michiel
comment:5 Changed 7 years ago by norman@…
Hi Michiel,
if I remove the htmlspecialchars() part in CoverageReportTask everything works fine for me, even if I did not remove the "disable-output-escaping" attribute in the xslt file. (... As I told you before ;-) ... okay, this statement by me was very bad formated in this wiki ...)
Maybe this will fix it for everybody. I think you should give this a try, put it in the repository and mark this as fixed?
Yours, Norman
comment:6 Changed 7 years ago by mrook
- Resolution set to fixed
- Status changed from assigned to closed
Norman, the fix has been committed in r54. You can reopen the bug if you continue to have problems.
Thanks! Michiel
comment:7 Changed 7 years ago by anonymous
Hi Michiel! r54 works for me! Thanks a lot, Norman

As far as I can see by now, the problem is, that a produced coverage.xml file will contain lines like this:
but this should better be:
Does that give you a hint?
BTW:
Changing line 190 in CoverageReportTask.php
form
to
helped a lot for me. But I am unsure if this is the right way to do it...
Thanks,
Norman