Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-24 Thread Josh Davis
On 24 May 2013 10:44, Stas Malyshev wrote: > > It is rather surprising that you would expect that as a PHP programmer, > since it never worked this way in PHP, and no PHP code works this way > either. I'm saying that "as a PHP programmer" because my expectation is not based on how other languages

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-24 Thread Etienne Kneuss
On Fri, May 24, 2013 at 10:44 AM, Stas Malyshev wrote: > Hi! > > > As a PHP programmer, I would always expect the file/line to refer to > > the throw statement that has thrown it last. If I wanted to keep track > > It is rather surprising that you would expect that as a PHP programmer, > since it

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-24 Thread Levi Morrison
> Also, throwing new exception with previous is not the same as throwing > the same exception twice. Correct, but I've personally never thrown the same exception twice. The only times I've thrown exceptions from catch blocks is to provide a better exception or perhaps to abstract away something in

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-24 Thread Stas Malyshev
Hi! > As a PHP programmer, I would always expect the file/line to refer to > the throw statement that has thrown it last. If I wanted to keep track It is rather surprising that you would expect that as a PHP programmer, since it never worked this way in PHP, and no PHP code works this way either.

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread Josh Davis
On 23 May 2013 22:22, Stas Malyshev wrote: > If we update file/line here, we lose original exception information and > file/line in the exception becomes useless. Right now, since 99.99% of > the code does "throw new", it is always useful. So how you would propose > to solve this? As a PHP progr

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread Adam Harvey
On 23 May 2013 17:14, Stas Malyshev wrote: > Hi! > >>> the code does "throw new", it is always useful. So how you would >>> propose >>> to solve this? >> >> rethrow $e; > > Yes, this is definitely an option, but requires a new keyword. We could use a C++ style throw; as an implicit rethrow. Adam

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread Stas Malyshev
Hi! >> the code does "throw new", it is always useful. So how you would >> propose >> to solve this? > > rethrow $e; Yes, this is definitely an option, but requires a new keyword. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Inter

RE: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread Jared Williams
> -Original Message- > From: Sebastian Bergmann [mailto:sebast...@php.net] > Sent: 23 May 2013 21:18 > To: internals@lists.php.net > Subject: [PHP-DEV] Bug #64910: Line number of $e = new > Exception vs. line number of throw $e > > Hi! > > The error

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread hakre
> On one hand, I think it makes sense - nobody really cares where the > exception was created... But there's one problem here: > > try { >     //stuff > } catch(Exception $e) { >     $logger->log("Oops, exception!"); >     throw $e; > } > > If we update file/line here, we lose original exceptio

Re: [PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread Stas Malyshev
Hi! > Derick agrees with me that this is a bug. We propose to update the file > and line properties of the exception object in the > zend_throw_exception_internal() and zend_throw_exception() functions. > > Would such a change be accepted? Does it require an RFC? On one hand, I think it make

[PHP-DEV] Bug #64910: Line number of $e = new Exception vs. line number of throw $e

2013-05-23 Thread Sebastian Bergmann
Hi! 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. Derick ag