Doc #53882 [Opn->Csd]: Exception::getLine method returns line where Exception created not Thrown
| From: | vrana@php.net | Date: | Thu, 10 Feb 2011 15:03:48 +0000 |
| Subject: | Doc #53882 [Opn->Csd]: Exception::getLine method returns line where Exception created not Thrown | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5964@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53882&edit=1
ID: 53882
Updated by: vrana@php.net
Reported by: james at jarofgreen dot co dot uk
Summary: Exception::getLine method returns line where
Exception created not Thrown
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: *General Issues
Operating System: Ubuntu
PHP Version: Irrelevant
-Assigned To:
+Assigned To: vrana
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Valid also for getFile().
Previous Comments:
------------------------------------------------------------------------
[2011-02-10 16:03:44] vrana@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=308198
Log: Exception informs about the point of creation not throwing (doc bug
#53882)
------------------------------------------------------------------------
[2011-01-30 01:01:28] james at jarofgreen dot co dot uk
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 this bug report at http://bugs.php.net/bug.php?id=53882&edit=1