File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #72793: xml_parser_free leaks mem when execute xml_set_object
3
+ --FILE--
4
+ <?php
5
+
6
+ class xml {
7
+ var $ parser ;
8
+
9
+ function __construct ()
10
+ {
11
+ $ this ->parser = xml_parser_create ();
12
+ xml_set_object ($ this ->parser , $ this );
13
+ }
14
+
15
+ function parse ($ data )
16
+ {
17
+ xml_parse ($ this ->parser , $ data );
18
+ }
19
+
20
+ function free (){
21
+ xml_parser_free ($ this ->parser );
22
+ }
23
+ }
24
+
25
+ $ xml_test = '<?xml version="1.0" encoding="utf-8"?><test></test> ' ;
26
+ $ xml_parser = new xml ();
27
+ $ xml_parser ->parse ($ xml_test );
28
+ $ xml_parser ->free ();
29
+
30
+ ?>
31
+ ===DONE===
32
+ --EXPECT--
33
+ ===DONE===
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #76874: xml_parser_free() should never leak memory
3
+ --FILE--
4
+ <?php
5
+
6
+ class c
7
+ {
8
+ private $ xml ;
9
+ private $ test ;
10
+
11
+ public function test ()
12
+ {
13
+ $ this ->xml = xml_parser_create ();
14
+ xml_set_character_data_handler ($ this ->xml , array (&$ this , 'handle_cdata ' ));
15
+ xml_parser_free ($ this ->xml );
16
+ }
17
+
18
+ public function handle_cdata (&$ parser , $ data )
19
+ {
20
+ }
21
+ }
22
+
23
+ $ object = new c ();
24
+ $ object ->test ();
25
+
26
+ ?>
27
+ ===DONE===
28
+ --EXPECT--
29
+ ===DONE===
You can’t perform that action at this time.
0 commit comments