xref: /php-src/ext/simplexml/tests/gh12929.phpt (revision f75931ad)
1--TEST--
2GH-12929 (SimpleXMLElement with stream_wrapper_register can segfault)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7$scheme = "foo1";
8stream_wrapper_register($scheme, "SimpleXMLIterator");
9try {
10    file_get_contents($scheme . "://x");
11} catch (Error $e) {
12    echo $e->getMessage(), "\n";
13    echo $e->getPrevious()->getMessage(), "\n";
14}
15
16$scheme = "foo2";
17stream_wrapper_register($scheme, "SimpleXMLElement");
18try {
19    file_get_contents($scheme . "://x");
20} catch (Error $e) {
21    echo $e->getMessage(), "\n";
22    echo $e->getPrevious()->getMessage(), "\n";
23}
24?>
25--EXPECT--
26It's not possible to assign a complex type to properties, resource given
27SimpleXMLElement is not properly initialized
28It's not possible to assign a complex type to properties, resource given
29SimpleXMLElement is not properly initialized
30