Strange corruption in PHP

I have a very strange output damage on one of my PHP sites. Sometimes a snippet of HTML code is displayed rather than tags that are interpreted. It seems that some characters are missing, messing up the tags. See the example below: the second line should be a link to c1 , but for some reason a portion of the destination URL is displayed.

alt text http://trappist.elis.ugent.be/~wheirman/atuin/tmp/phpstrangeness.png

The problem is temporary, updating usually solves it. This can happen on different parts of the page (although often in one place). Only Safari seems to be affected (but I suspect Firefox is simply masking the issue due to a more tolerant parsing). This happens both on my development server and on a live one, they have slightly different settings (output buffering, channel transfer), although the likelihood that this will apparently change.

Has anyone seen something like this?

EDIT

When I look at the "Source" in Safari on this page, I get the following HTML:

<tr class="odd"> <td>73</td> <td><a href="companies.php?view=1&amp;companyid=73&amp;return=%2Foffice%2Fcompanies.php">c1</a></td> <td></td> <td><img src='/images/dot_blue.png' class="altTooltip" alt="inactive: no account" /> </td> 

I don’t see anything wrong with that, so either Safari reloaded the page when I asked for the source, or I don’t look complicated enough ...

+4
source share
3 answers

I finally found a problem (using the Web Inspector): TinyMCE inserted tags (which it uses to load language files and extension modules), apparently in random places inside my own HTML. As a result, in the case visible from my screenshot, something like <a href="foo<script src="tinymce/lang/en.js">bar.php">foobar</a> .

Since I also use jQuery on the same page, I assume that this ultimately caused the jQuery modification for the DOM and TinyMCE add-ons, while it led to some race condition (caused by an error that only appears in Safari).

Now I am using jQuery TinyMCE assembly and everything went well ...

Thank you all for your help!

+1
source

Well, here is my shot in the dark.

The gap occurs in the word "office" after a combination of characters. I would argue that the ligature is somehow causing problems.

How exactly? Since this HTML code does not contain a ligature character, this may be a bug in Safari. Moreover, this happens randomly. Could you rename this file and see if the problem persists?

Having valid HTML can also help avoid this problem, because it simplifies the analysis.

+2
source

When you select a piece of HTML and look at the source, what you get is not 100% what it is. For example, all of you and &amp; , which probably means that you selected the violating text and looked at the source of the selection.

If you still have a problem trying to browse the entire source code without selecting anything, and then using ctrl + f to find a spot in the code, try and give us a larger sample, not just an offensive line, but a correct line and more wide context.

For example, when using tables, an invalid <td> can have very strange consequences, this is not like this type of problem, I just say that we need context in order to be able to help.

There is also a problem that some browsers, in order to view the source, actually re-submit the page and receive a second copy. I have a feeling that this is code that outputs text, so look and see if you use something like

 <?= $someVar ?> 

and make sure this is not the case:

 <a href=<?= isset($x) ?'"'. $someVar.'"': '"'.$someOlderVar.'">'?>> xxx </a> 

So, there is no choice and a larger sample. And we really need something from the code that outputs the erroneous HTML ...

+1
source

Source: https://habr.com/ru/post/1299887/


All Articles