1--TEST-- 2Testing xpath() with invalid XML 3--EXTENSIONS-- 4simplexml 5--FILE-- 6<?php 7// gracefully recover from parsing of invalid XML; not available in PHP 8const XML_PARSE_RECOVER = 1; 9 10// we're not interested in checking concrete warnings regarding invalid XML 11$xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER); 12 13// $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL 14try { 15 var_dump($xml->xpath("BBBB")); 16} catch (Error $e) { 17 echo $e->getMessage(), "\n"; 18} 19?> 20--EXPECT-- 21SimpleXMLElement is not properly initialized 22