[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    [PHP-DEV] Bug #14783: Using unlink causes segfault
From:       mfkahn2 () yahoo ! com
Date:       2001-12-31 21:16:29
[Download RAW message or body]

From:             mfkahn2@yahoo.com
Operating system: RH6.2/Apache/libxml2.4.12
PHP version:      4.1.1
PHP Bug Type:     DOM XML related
Bug description:  Using unlink causes segfault

Symptoms:
- using unlink() causes segfault

Script to reproduce:

<?php
$xml = <<<END_XML
<?xml version="1.0"?>
<test>
        <foo id="x">Hello</foo>
        <foo id="y">World</foo>
</test>
END_XML;
$dom = xmldoc($xml);

// this so I can see it.
header('Content-type: text/plain');

$ctx = $dom->xpath_new_context();

$res = xpath_eval($ctx,"//foo");

foreach ($res->nodeset as $child) {
        $child->unlink();
} 

echo $dom->dumpmem();
?>

Other notes:

- some cursory debugging I did suggested that it was the cleanup routines
at the end of the script that were causing the crash.  Looking at
php_domxml.c, the recursive node memory cleanup appears to be choking on a
pointer already freed during the unlink() call.
-- 
Edit bug report at: http://bugs.php.net/?id=14783&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic