From:             sebastian
Operating system: Irrelevant
PHP version:      5.5Git-2013-05-23 (Git)
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Line number of $e = new Exception vs. line number of throw $e

Description:
------------
The error message that is created for an uncaught exception as well as the
stacktrace of an exception list the number of the line on which the
exception object was created. I would expect this to be number of the line
on which the exception is raised using the throw statement.

Also note that the documentation on this is inconsistent: the
Exception::getLine() method is documented with "Gets the line in which the
exception occurred" whereas the Exception::$line attribute is documented
with "The line where the exception was created".

Test script:
---------------
<?php
$e = new Exception;
throw $e;

Expected result:
----------------
Fatal error: Uncaught exception 'Exception' in /home/sb/test.php:3
Stack trace:
#0 {main}
  thrown in /home/sb/test.php on line 3

Actual result:
--------------
Fatal error: Uncaught exception 'Exception' in /home/sb/test.php:2
Stack trace:
#0 {main}
  thrown in /home/sb/test.php on line 2

-- 
Edit bug report at https://bugs.php.net/bug.php?id=64910&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64910&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64910&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64910&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64910&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64910&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64910&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64910&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64910&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64910&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64910&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64910&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64910&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64910&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64910&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64910&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64910&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64910&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64910&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64910&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64910&r=mysqlcfg

Reply via email to