php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32340 insert_before($node,NULL) does not return
Submitted: 2005-03-16 16:41 UTC Modified: 2005-03-17 14:14 UTC
From: felix at fbreuer dot de Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.3.10 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: felix at fbreuer dot de
New email:
PHP Version: OS:

 

 [2005-03-16 16:41 UTC] felix at fbreuer dot de
Description:
------------
When using insert_before($node,NULL) to insert a DOM element as the last child of some other element, insert_before never returns (and does not throw an error). 

This call will work, if $node is unlinked before. The documentation of insert_node, however, says that unlinking is not required.

See example code below.

Reproduce code:
---------------
<?php

$doc = domxml_open_mem("<foo><bar/></foo>");
$dom = domxml_open_mem("<outer><inner/></outer>");
$root = $doc->document_element();
$node = $dom->document_element();
//$node->unlink_node(); // uncomment this to work
$root->insert_before($node,NULL);
echo $doc->dump_mem();

?> 

Expected result:
----------------
Ideally:

<foo><bar/><outer><inner/></outer></foo>

If it is desired that the user has to explicitly unlink the node before inserting it, it would be nice to have an error message. insert_before should not hang.

Actual result:
--------------
insert_before does not return. The page is never sent to the client. No error message is given.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-17 14:14 UTC] rrichards@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC