in classes/api/base.php [1181:1204]
protected function process_br_tags($xpath) {
$brnodes = $xpath->query('//br');
if ($brnodes) {
$count = $brnodes->length;
$index = 0;
while ($index < $count) {
$brnode = $brnodes->item($index);
// Replace only the last br in a sequence with a p.
$nextsibling = $brnode->nextSibling;
while ($nextsibling && ($nextsibling->nodeName == 'br')) {
$brnode = $nextsibling;
$nextsibling = $brnode->nextSibling;
$index++;
}
$pnode = new \DOMElement('p', ' ');
$brnode->parentNode->replaceChild($pnode, $brnode);
$index++;
}
}
}