xref: /php-src/ext/dom/tests/gh15670.phpt (revision 82c504fa)
1--TEST--
2GH-15670 (Polymorphic cache slot issue in DOM)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$doc = new DOMDocument();
8$doc->loadHTML('<p id=x>foo</p>');
9$dom = DOM\XMLDocument::createFromString('<root/>');
10$child = $dom->documentElement->appendChild($dom->createElementNS('urn:a', 'child'));
11function test($child, $html) {
12    try {
13        $child->innerHTML = $html;
14    } catch (DOMException $e) {
15    }
16}
17test($child, '--></root><!--');
18test($doc, '<');
19echo $doc->saveXML(), "\n";
20echo $dom->saveXML(), "\n";
21?>
22--EXPECTF--
23Deprecated: Creation of dynamic property DOMDocument::$innerHTML is deprecated in %s on line %d
24<?xml version="1.0" standalone="yes"?>
25<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
26<html><body><p id="x">foo</p></body></html>
27
28<?xml version="1.0" encoding="UTF-8"?>
29<root><child xmlns="urn:a"/></root>
30