1--TEST-- 2libxml_set_streams_context() 3--SKIPIF-- 4<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?> 5--FILE-- 6<?php 7 8$ctxs = array( 9 NULL, 10 'bogus', 11 123, 12 new stdclass, 13 array('a'), 14 stream_context_create(), 15); 16 17foreach ($ctxs as $ctx) { 18 try { 19 var_dump(libxml_set_streams_context($ctx)); 20 } catch (TypeError $e) { 21 echo $e->getMessage(), "\n"; 22 } 23 $dom = new DOMDocument(); 24 var_dump($dom->load(__DIR__.'/test.xml')); 25} 26 27echo "Done\n"; 28 29?> 30--EXPECT-- 31libxml_set_streams_context(): Argument #1 ($context) must be of type resource, null given 32bool(true) 33libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given 34bool(true) 35libxml_set_streams_context(): Argument #1 ($context) must be of type resource, int given 36bool(true) 37libxml_set_streams_context(): Argument #1 ($context) must be of type resource, stdClass given 38bool(true) 39libxml_set_streams_context(): Argument #1 ($context) must be of type resource, array given 40bool(true) 41NULL 42bool(true) 43Done 44