1

I'm using gettext to translate my website. One key has a translations with a html tag:

msgid "BANNER_TAG_START"
msgstr "<!-- // MY BANNER TAG -->"

if I use this code in php now:

var_dump(htmlspecialchars(gettext('BANNER_TAG_START')));

it normally should returns:

<!-- // MY BANNER TAG -->

most times it works like this, but sometimes I get:

MY BANNER TAG

Why do I sometimes get this wrong code?

MaxiNet
  • 1,008
  • 2
  • 14
  • 22
  • Can you narrow down "sometimes"? When does what happens? A randomly different output on each page load is implausible. – feeela Jun 27 '12 at 13:07
  • if I reload the same page 100 times, I get it about 3 to 5 times... but it is always the same site. same parameters and so on. really strange – MaxiNet Jun 27 '12 at 13:09

1 Answers1

0

In my env, running the following code,

var_dump(htmlspecialchars("<!-- // MY BANNER TAG -->"));

returns this,

string(31) "&lt;!-- // MY BANNER TAG --&gt;"

not

<!-- // MY BANNER TAG -->

as you reported. So I assume you are reporting the final rendered text on your browser, instead of the generated HTML source code.

Please check the 3-5 in 100 times where the problem happen in the generated HTML source code, and check if the what kind of other letters or line-breaks exist BEFORE the "<!-- //", then you may find the difference for the 3-5 cases.

akky
  • 2,818
  • 21
  • 31