Viewed   85 times

Whenever we are fetching some user inputed content with some editing from the database or similar sources, we might retrieve the portion which only contains the opening tag but no closing.

This can hamper the website's current layout.

Is there a clientside or serverside way of fixing this?

 Answers

3

Found a great answer for this one:

Use PHP 5 and use the loadHTML() method of the DOMDocument object. This auto parses badly formed HTML and a subsequent call to saveXML() will output the valid HTML. The DOM functions can be found here:

http://www.php.net/dom

The usage of this:

$doc = new DOMDocument();
$doc->loadHTML($yourText);
$yourText = $doc->saveHTML();
Friday, December 2, 2022
2

2387507830 == -1907459466 when using unsigned integers (look at the bit values of the least significant bits)

2387507830 = 0000 0000 0000 0000 0000 0000 0000 0000 1000 1110 0100 1110 0111 1010 0111 0110 -1907459466= 1111 1111 1111 1111 1111 1111 1111 1111 1000 1110 0100 1110 0111 1010 0111 0110

your problem is a 32 bit roll over. To compensate you can simply & 0xffffffff which will 0 out the most significant 32 bits, and make both answers the same.

Friday, August 12, 2022
 
jean_b.
 
1

I've worked around this by providing a login link on the page using the php-SDK getLoginUrl() and having the users use that instead of doing a client-side call to the javascript login() function or using the facebook social/login plugin. It might run into drawbacks at some point, but for now this seems to work on machine(s) that have 3rd party-cookies disabled

Friday, October 7, 2022
 
sleske
 
4

This is not an easy task. You might want to look at Tidy:

Tidy is a binding for the Tidy HTML clean and repair utility which allows you to not only clean and otherwise manipulate HTML documents, but also traverse the document tree.

http://php.net/manual/en/book.tidy.php

Wednesday, October 5, 2022
 
tobixen
 
2

It is not possible right now - there is a related ticket https://youtrack.jetbrains.com/issue/RSRP-434190.

Sunday, November 6, 2022
 
shou
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :