Doc #53882 [NEW]: Exception::getLine method returns line where Exception created not Thrown
| From: | james at jarofgreen dot co dot uk | Date: | Sun, 30 Jan 2011 00:01:28 +0000 |
| Subject: | Doc #53882 [NEW]: Exception::getLine method returns line where Exception created not Thrown | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-5889@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu
PHP version: Irrelevant
Package: *General Issues
Bug Type: Documentation Problem
Bug description:Exception::getLine method returns line where Exception created not Thrown
Description:
------------
http://www.php.net/manual/en/exception.getline.php
says "Returns line
number where the exception was thrown."
However it seems to be returning the line number the Exception was created,
not thrown.
Either:
A) This is a code bug.
B) This is a documentation bug.
I am using PHP Version 5.3.3-1ubuntu9.3
I found http://bugs.php.net/bug.php?id=33407
which seems to suggest this is
how the code is meant to work. In this case the documentation is wrong.
Test script:
---------------
Change the sample code from that page slightly to:
<?php
try {
$e = new Exception("Some error message");
throw $e;
} catch(Exception $e) {
echo "The exception was thrown on line: " . $e->getLine();
}
?>
Expected result:
----------------
The exception was thrown on line: 4
Because line 4 is the line where the Exception was Thrown.
Actual result:
--------------
The exception was thrown on line: 3
That's the line where the Exception was created. This contradicts the
documentation.
--
Edit bug report at http://bugs.php.net/bug.php?id=53882&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53882&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53882&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53882&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53882&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53882&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53882&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53882&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53882&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53882&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53882&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53882&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53882&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53882&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53882&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53882&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53882&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53882&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53882&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53882&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53882&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53882&r=mysqlcfg