MediaWiki  master
PhpXmlBugTester.php
Go to the documentation of this file.
1 <?php
33  private $parsedData = '';
34  public $ok = false;
35 
36  public function __construct() {
37  $charData = '<b>c</b>';
38  $xml = '<a>' . htmlspecialchars( $charData ) . '</a>';
39 
40  $parser = xml_parser_create();
41  xml_set_character_data_handler( $parser, [ $this, 'chardata' ] );
42  $parsedOk = xml_parse( $parser, $xml, true );
43  $this->ok = $parsedOk && ( $this->parsedData == $charData );
44  }
45 
46  public function chardata( $parser, $data ) {
47  $this->parsedData .= $data;
48  }
49 }
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
chardata( $parser, $data)