--TEST--
Bug #80602 (Segfault when using DOMChildNode::before())
--EXTENSIONS--
dom
--FILE--
loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($target);
echo "1 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($target);
echo "2 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($doc->documentElement->lastChild);
echo "3 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($doc->documentElement->firstChild);
echo "4 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($target, $doc->documentElement->lastChild);
echo "5 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($doc->documentElement->lastChild, $target);
echo "6 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($target, $doc->documentElement->firstChild);
echo "7 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($doc->documentElement->firstChild, $target);
echo "8 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before('bar','baz');
echo "9 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before('bar','baz');
echo "10 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($target, 'bar','baz');
echo "11 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before('bar', $target, 'baz');
echo "12 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before('bar', 'baz', $target);
echo "13 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($target, 'bar','baz');
echo "14 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before('bar', $target, 'baz');
echo "15 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before('bar', 'baz', $target);
echo "16 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before('bar', $target, $doc->documentElement->lastChild);
echo "17 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($target, 'bar', $doc->documentElement->lastChild);
echo "18 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->firstChild;
$target->before($target, $doc->documentElement->lastChild, 'bar');
echo "19 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before('bar', $doc->documentElement->firstChild, $target);
echo "20 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($doc->documentElement->firstChild, 'bar', $target);
echo "21 ", $doc->saveXML($doc->documentElement).PHP_EOL;
$doc = new \DOMDocument();
$doc->loadXML('foo');
$target = $doc->documentElement->lastChild;
$target->before($doc->documentElement->firstChild, $target, 'bar');
echo "22 ", $doc->saveXML($doc->documentElement).PHP_EOL;
?>
--EXPECTF--
1 foo
2 foo
3 foo
4 foo
5 foo
6 foo
7 foo
8 foo
9 barbazfoo
10 foobarbaz
11 foobarbaz
12 barfoobaz
13 barbazfoo
14 foobarbaz
15 foobarbaz
16 foobarbaz
17 barfoo
18 foobar
19 foobar
20 barfoo
21 foobar
22 foobar