Access to RFC: Spl needs extensive improvements.
| From: | Levi Morrison | Date: | Tue, 13 Dec 2011 17:06:16 +0000 |
| Subject: | Access to RFC: Spl needs extensive improvements. | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-12631@lists.php.net to get a copy of this message | ||
Hello,
I would like to improve the Spl. Some of the problems I can fix without
any approval, such as updating the documentation to update the exceptions
thrown in function. However, while gathering that information I have
discovered that the types of exceptions thrown inside the SPL are
inconsistent. For example,
*SplStack throws an OutOfRangeException* when it encounters an index that
doesn't exist. encounters an index that doesn't exist. I don't agree with
this choice, but that's only part of the issue.
*SplFixedArray throws a generic RuntimeException* when it encounters an
index that doesn't exist. I have a patch ready to fix this for
SplFixedArray, but I discovered it wasn't an isolated incident.
*This is inconsistent. *They should throw the same exception.
Unfortunately, it breaks backwards compatibility to fix because
OutOfRangeException is a LogicException. Personally, LogicException seems
like a poor choice as accessing an index in other languages is always a
runtime exceptions. I think OutOfBoundsException is the most appropriate.
This is only the surface of the problem. I would like to propose all of
the changes I think should take place. Starting an RFC seems like the best
way to get others to support this change.
Thank you,
Levi Morrison