1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00
Files
archived-php-src/ext/xml/tests/bug72793.phpt
T
Nikita Popov e35a3cb28c ext/xml: Use object instead of resource
Use an XmlParser object instead of a resource. This is an internal
representation change, not a conversion to OO APIs. XmlParser objects
cannot be explicitly constructed, they are created through the usual
xml_parser_* APIs.

This change allows us to provide a proper get_gc() implementation,
thus resolving bugs #72793 and #76874.

xml_parser_free() is a no-op now and need not be called anymore.
2019-04-08 16:23:13 +02:00

34 lines
584 B
PHP

--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===