xref: /PHP-8.4/ext/xml/tests/bug72793.phpt (revision 25b46965)
1--TEST--
2Bug #72793: xml_parser_free leaks mem when execute xml_set_object
3--EXTENSIONS--
4xml
5--FILE--
6<?php
7
8class xml  {
9    var $parser;
10
11    function __construct()
12    {
13        $this->parser = xml_parser_create();
14        xml_set_object($this->parser, $this);
15    }
16
17    function parse($data)
18    {
19        xml_parse($this->parser, $data);
20    }
21
22    function free(){
23        xml_parser_free($this->parser);
24    }
25}
26
27$xml_test = '<?xml version="1.0" encoding="utf-8"?><test></test>';
28$xml_parser = new xml();
29$xml_parser->parse($xml_test);
30$xml_parser->free();
31
32?>
33===DONE===
34--EXPECTF--
35Deprecated: Function xml_set_object() is deprecated since 8.4, provide a proper method callable to xml_set_*_handler() functions in %s on line %d
36===DONE===
37