Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions ext/xml/tests/bug72793.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
Bug #72793: xml_parser_free leaks mem when execute xml_set_object
--FILE--
<?php

class xml {
var $parser;

function __construct()
{
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
}

function parse($data)
{
xml_parse($this->parser, $data);
}

function free(){
xml_parser_free($this->parser);
}
}

$xml_test = '<?xml version="1.0" encoding="utf-8"?><test></test>';
$xml_parser = new xml();
$xml_parser->parse($xml_test);
$xml_parser->free();

?>
===DONE===
--EXPECT--
===DONE===
29 changes: 29 additions & 0 deletions ext/xml/tests/bug76874.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
Bug #76874: xml_parser_free() should never leak memory
--FILE--
<?php

class c
{
private $xml;
private $test;

public function test()
{
$this->xml = xml_parser_create();
xml_set_character_data_handler($this->xml, array(&$this, 'handle_cdata'));
xml_parser_free($this->xml);
}

public function handle_cdata(&$parser, $data)
{
}
}

$object = new c();
$object->test();

?>
===DONE===
--EXPECT--
===DONE===
Loading