Skip to content

Assertion failure in ext/dom/parentnode/tree.c #16151

Description

@chibinz

Description

The following code:

<?php

$comment = new DOMComment ( "h" );
$element = new DOMElement ( "N" , "W" , "y" );
$attr = new DOMAttr ( "c" , "n" );
$doc = new DOMDocument (  );
$doc -> adoptNode ( $element );
$element -> setAttributeNodeNS ( $attr );
$attr -> insertBefore ( $comment );
$comment -> replaceWith ( "Q" );

Resulted in this output:

php: /tmp/php-afl/ext/dom/parentnode/tree.c:243: _Bool dom_is_pre_insert_valid_without_step_1(php_libxml_ref_obj *, xmlNodePtr, xmlNodePtr, xmlNodePtr, xmlDocPtr): Assertion `!php_dom_pre_insert_is_parent_invalid(parentNode)' failed.

But I expected this output instead:

no crash

PHP Version

PHP 8.4.0-dev

Operating System

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions