Okay I'm trying to create an API.
I need to it be user friendly so it can't output an errors.
I've used a try {} catch() {} in this class and purposely passed a file doesn't exist to the constructor.
I would expect $x to just return false and the script to die but I get this error:
Quote:
|
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: I/O warning : failed to load external entity "settings.php" in C:\Web\XML\XMLsettingsCMS\parse.php on line 56
|
And this is my class and it being instantiated.
- PHP: Select all
class XMLstore {
private $XML;
function __construct($xmlfile) {
$this->XML = $xmlfile;
try {
$this->handle = new SimpleXMLElement($this->XML, NULL, true);
}
catch(Exception $e) {
return false;
}
}
}
if(!$x = new XMLstore('settings.php')) { die("Couldn't be done"); }