Doc #53877 [NEW]: SPL exception definitions are too ambiguous
| From: | nightstorm at tlen dot pl | Date: | Sat, 29 Jan 2011 08:54:28 +0000 |
| Subject: | Doc #53877 [NEW]: SPL exception definitions are too ambiguous | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-5887@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:SPL exception definitions are too ambiguous
Description:
------------
The SPL exception definitions in the official manual are too ambiguous. As
I talked to programmers, I noticed that many have problems with
understanding, how to use them properly. Furthermore, the older
documentation was more precise here and I think the authors should
seriously consider writing something more about them.
Here's, what should be added:
LogicException:
- Description: "Exception that represents error in the program logic. This
kind of exceptions should directly leed to a fix in your code."
- Source: copied from
http://www.php.net/~helly/php/ext/spl/classLogicException.html
OutOfRangeException:
- here, the description is completely wrong and makes no sense, if we look
at the class diagram. According to docs.php.net, this class should extend
RuntimeException, not LogicException.
- Valid description: "Exception thrown when an illegal index was
requested. This represents errors that should be detected at compile
time."
- Source: copied from
http://www.php.net/~helly/php/ext/spl/classOutOfRangeException.html
RangeException:
- identical case, as OutOfRangeException
- Valid description: "Exception thrown to indicate range errors during
program execution. Normally this means there was an arithmetic error other
than under/overflow. This is the runtime version of DomainException."
- Source: copied from
http://www.php.net/~helly/php/ext/spl/classRangeException.html
OutOfBoundsException:
- "This represents errors that cannot be detected at compile time." should
be added, as it is in
http://docs.php.net/manual/en/class.outofboundsexception.php
UnexpectedValue:
- "Typically this happens when a function calls another function and
espects the return value to be of a certain type or value not including
arithmetic or buffer related errors." should be added, as it is in
http://docs.php.net/manual/en/class.unexpectedvalueexception.php
LogicException:
- The old documentation at http://www.php.net/~helly/php/ext/spl/ and the
official one say two completely different things about this exception.
Decide: does it mean that the specified length makes no sense (i.e. because
it is negative, and length cannot be negative), or that some value has an
invalid length, but then - why does it extend LogicException in this case?
If it extends, it should be clarified that it should be only used on errors
in the program logic, not to validate user data.
--
Edit bug report at http://bugs.php.net/bug.php?id=53877&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53877&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53877&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53877&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53877&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53877&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53877&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53877&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53877&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53877&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53877&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53877&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53877&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53877&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53877&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53877&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53877&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53877&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53877&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53877&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53877&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53877&r=mysqlcfg