Menu

#127 Incorrect attribute value gives unexpected results

closed
None
2018-12-06
2013-04-24
index
No

Please notice how title attribute of first A element ends.

<?php
    include('simple_html_dom.php');

    $html = <<<END
    <a href='#' title='title text ending with\'>05 march 2013</a>
    <ul class='css_class'>
        <li>
            <a href='#' title='simple title text'>22 march 2012</a>
        </li>
    </ul>
END;

    $html = str_get_html($html);

    foreach($html->find('a') as $e) {
        echo $e->innertext . "\n\n";
    }
?>

Discussion

  • LogMANOriginal

    LogMANOriginal - 2018-12-06

    Thanks for reporting this issue. The parser considered \' as escape sequence, which is the root cause of your issue. [593d99] fixes this issue by ignoring backslash characters. They are regular characters in HTML anyway.

     

    Related

    Commit: [593d99]

  • LogMANOriginal

    LogMANOriginal - 2018-12-06
    • status: open --> closed
    • assigned_to: LogMANOriginal
     

Log in to post a comment.

MongoDB Logo MongoDB