php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14522 Crash with using $node->unlink();
Submitted: 2001-12-14 13:30 UTC Modified: 2002-03-23 06:16 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: klebermass at limtec dot de Assigned:
Status: Closed Package: DOM XML related
PHP Version: CVS Download OS: SuSe 7.3
Private report: No CVE-ID: None
 [2001-12-14 13:30 UTC] klebermass at limtec dot de
When using the  unlink() method the  apache proccess always gets a  SegFault.

an information on what php is running on my maschine
http://www.limtec.com:82/info.php


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-14 14:13 UTC] mfischer@php.net
Please provide a short, self-containing, reproduceable, easy copy&paste script.

Feedback.
 [2001-12-14 15:46 UTC] derick@php.net
Please try it with a snapshot from snaps.php.net too...

Derick
 [2002-01-06 07:31 UTC] sander@php.net
No feedback. Closing.
 [2002-01-07 12:16 UTC] klebermass at limtec dot de
Sorry i havent been at home the second part of December.

Here a sample code:

<?php
$xmlstruc=xmldoc("<?xml version=\"1.0\" standalone=\"no\" ?><root><down>bla</down></root>");

$xmlnode=$xmlstruc->root();
        $xmlchilds=$xmlnode->children();
        if(!is_array($xmlchilds)) $xmlchilds=array($xmlchilds);
        foreach ( $xmlchilds as $workingchild) {
                        $workingchild->unlink();}

echo $xmlstruc->dumpmem();


?>


martin
 [2002-02-12 16:22 UTC] rrichards at digarc dot com
We have also reproduced this error on both RedHat 7.2 and FreeBSD 4.4 both running PHP 4.1.1.  It completely takes down FREEBSD as apache continues to log seg faults until the drive is full.  We had the same results with 4.0.6 prior to the upgrade as well.
 [2002-02-19 12:23 UTC] klebermass at limtec dot de
Nothing happening about the bug? Un Downloading regularly the newest CVS Version but doesnt help
 [2002-02-19 13:43 UTC] lukas at edeal dot de
This patch against latest CVS should fix it:
(basically it makes domxml not free a node on unlink and
rather wait for request shutdown to free a node).

btw, this patch also enables a domxml user to re-add a
previously unlink()ed node, which is impossible with
the current code.


regards,
  -lukas


Index: ext/domxml/php_domxml.c
===================================================================
RCS file: /repository/php4/ext/domxml/php_domxml.c,v
retrieving revision 1.116
diff -u -r1.116 php_domxml.c
--- ext/domxml/php_domxml.c     4 Feb 2002 21:07:39 -0000       1.116
+++ ext/domxml/php_domxml.c     19 Feb 2002 18:38:57 -0000
@@ -1801,8 +1801,6 @@
        DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
 
        xmlUnlinkNode(nodep);
-       xmlFreeNode(nodep);
-       zval_dtor(id);                          /* This is not enough because the children won't be deleted */
 }
 /* }}} */
 [2002-02-19 15:16 UTC] klebermass at limtec dot de
The patch from lukas@edeal.de worked on my Server.

Hope it will be soon in the CVS Version 
 [2002-03-07 17:59 UTC] lukas at edeal dot de
beware: the bug is marked as closed, but a fix has not been applied to cvs yet.
 [2002-03-07 18:53 UTC] jtate@php.net
I've commented out the offending lines in the source.  You can pull it from CVS at any time.  I'll also see if we can get it into the 4.2.0 release.  Thanks for bringing it up again.
 [2002-03-08 02:24 UTC] derick@php.net
The script posted here does not crash for me with the latest CVS (27-03-2002). Can you try a snapshot from snaps.php.net?

Derick
 [2002-03-08 03:38 UTC] lukas at edeal dot de
derick,

as of latest CVS (HEAD, php_domxml.c rev.1.120) a fix similar to the patch within this bug's history has already been committed by jtate (rev.1.119 was the last to crash on me)

if you tested with latest head cvs, it's no wonder you dont see the php barf ;)
 [2002-03-23 03:52 UTC] 767 at gmx dot net
having the same problem with php 4.1.2 on w2k. where's the fix?
 [2002-03-23 06:16 UTC] derick@php.net
It's fixed in CVS, so closing. This fix will be in version 4.2.0

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 00:01:31 2024 UTC