php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56562 Opening remote XML always return true
Submitted: 2005-09-26 10:22 UTC Modified: 2005-10-23 06:39 UTC
From: uros dot gruber at vizija dot si Assigned: rrichards (profile)
Status: Closed Package: xmlReader (PECL)
PHP Version: Irrelevant OS: FreeBSD
Private report: No CVE-ID: None
 [2005-09-26 10:22 UTC] uros dot gruber at vizija dot si
Description:
------------
If you try to open remote XML file and the file does not exist it return true instead of false.

Also in any error script create a warning which IMHO is "stupid" thing to do. For example: We use Zend Platform and have enabled warning events. And everytime xml file can't be read because of net failure, we have a new warning. But if file can't be open it must return false and then in some other mechanism to report what kind of an error.

I talk with Christian and disapoint me that Exceptions is not on todo list. Instead of that there is some other "better" error handling. I think Exceptions would be great in such situations. Java do it, .net also. Why should be any difference here.

Reproduce code:
---------------
$reader = new XMLReader();
$res = $reader->open('http://somesite.com/filename.xml');

if ($res) {
    echo "ok";
} else {
    echo "not found";
}

?>

Expected result:
----------------
not found

Actual result:
--------------
ok

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-23 06:39 UTC] rrichards@php.net
problem was elsewhere and is fixed in the 5.1 branch. Unable to fix behavior for the PECL extension to use with 5.0 though.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Feb 27 19:01:24 2021 UTC