PHP is lacking of some elemental exceptions. One obvious example would be
FileNotFoundException.
Java has a FileNotFoundException,
C# has a FileNotFoundException,
Python has a FileNotFoundError, ...
Why doesn't PHP provide a bundled FileNotFoundException or at least a more
general IOException?
Because of this shortcoming, developers must address this lack by creating
the same custom exceptions repeatedly.
This is a suggestion/open discussion, sorry if I didn't post it in the
right mailing list.
- Mathieu
PHP is lacking of some elemental exceptions. One obvious example would be
FileNotFoundException.Java has a FileNotFoundException,
C# has a FileNotFoundException,
Python has a FileNotFoundError, ...Why doesn't PHP provide a bundled FileNotFoundException or at least a more
general IOException?
Presumably this is because most of PHP’s I/O stuff still uses procedural APIs with error return values.
One of the things I’d like to see happen, but don’t have the time to do myself, is get rid of the IS_RESOURCE type from PHP for PHP 7, and replace all instances with objects. As part of this, we’d need to convert streams to using objects, which would give us an opportunity to create a new OOP stream API, learning from our past mistakes and which uses exceptions. As part of that, I’m sure we’d add some I/O exceptions.
--
Andrea Faulds
http://ajf.me/
One of the things I’d like to see happen, but don’t have the time to do myself, is get rid of the IS_RESOURCE type from PHP for PHP 7, and replace all instances with objects. As part of this, we’d need to convert streams to using objects, which would give us an opportunity to create a new OOP stream API, learning from our past mistakes and which uses exceptions. As part of that, I’m sure we’d add some I/O exceptions.
--
Andrea Faulds
http://ajf.me/
Yes please!!
(I'm not a C dev, but would be happy to help brainstorm/rubber duck with
someone who is on this front if there is interest.)
--Larry Garfield