MediaWiki  1.34.0
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 }
PhpXmlBugTester\chardata
chardata( $parser, $data)
Definition: PhpXmlBugTester.php:46
PhpXmlBugTester\$ok
$ok
Definition: PhpXmlBugTester.php:34
PhpXmlBugTester\$parsedData
$parsedData
Definition: PhpXmlBugTester.php:33
PhpXmlBugTester\__construct
__construct()
Definition: PhpXmlBugTester.php:36
PhpXmlBugTester
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
Definition: PhpXmlBugTester.php:32