[PHP-DEV] Exception::getLine()

2016-05-19 Thread Rasmus Schultz
Does this work as intended? function create_exception() { return new RuntimeException(); // line 2 } try { throw create_exception(); // line 6 } catch (Exception $e) { var_dump($e); // => 2 } I would have expected Exception::getLine() to return 6 in this case - the line where the exc

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Tim Düsterhus
On 19.05.2016 13:14, Rasmus Schultz wrote: > I know that I can dig in via e.g. > Exception::getStackTrace()[0]["line"] and pull the relevant > line-number myself, but I'm wondering why the line-number 2 is > relevant, important or interesting at all? If you are rethrowing exceptions inside the cat

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Sebastian Bergmann
Am 19.05.2016 um 13:14 schrieb Rasmus Schultz: > Does this work as intended? According to https://bugs.php.net/bug.php?id=64910 it does :-( -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Niklas Keller
Sebastian Bergmann schrieb am Do., 19. Mai 2016 14:12: > Am 19.05.2016 um 13:14 schrieb Rasmus Schultz: > > Does this work as intended? > > According to https://bugs.php.net/bug.php?id=64910 it does :-( > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://

[PHP-DEV] UGLY Benchmark Results for PHP Master 2016-05-19

2016-05-19 Thread lp_benchmark_robot
Results for project PHP master, build date 2016-05-19 06:28:59+03:00 commit: 88196e9 previous commit:14023d3 revision date: 2016-05-18 15:06:49+03:00 environment:Haswell-EP cpu:Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Rasmus Schultz
> Exceptions in PHP are always populated upon creation Wow. Well, I've always wondered why the throw site wasn't in the stack trace - this explains that. This is inconsistent with at least JavaScript and C#, where the stack trace is populated at the throw site. (Probably others?) That doesn't r

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Rowan Collins
On 19/05/2016 19:35, Rasmus Schultz wrote: Technically, every throw is a new exception "flow" - even if you're > recycling the Exception instance, it's the throw statement that > starts the unique stack unwind from the throw site; it's where the > action happens. That's one interpretation, but

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Ryan Pallas
On Thu, May 19, 2016 at 1:47 PM, Rowan Collins wrote: > On 19/05/2016 19:35, Rasmus Schultz wrote: > >> Technically, every throw is a new exception "flow" - even if you're > >> recycling the Exception instance, it's the throw statement that > >> > starts the unique stack unwind from the throw sit

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Rasmus Schultz
> True, but if you instead of throwing the same exception, threw a new one, you > could capture both stacks. But you can never get the stack from the throw > point of something created elsewhere. Precisely. I think there are good reasons why other languages collect the stack-trace on throw. Co

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Rowan Collins
On 19/05/2016 21:30, Ryan Pallas wrote: Of what value to a subsequent catch statement is the trace of that throw statement? And why does that "start a new exception flow", but if PDO threw different sub-classes, you could let one flow through unmodified by tightening the catch st

Re: [PHP-DEV] Exception::getLine()

2016-05-19 Thread Jesse Schalken
On Fri, May 20, 2016 at 4:35 AM, Rasmus Schultz wrote: > This is inconsistent with at least JavaScript and C#, where the stack > trace is populated at the throw site. (Probably others?) > I'm not sure about C#, but in JavaScript (Node.js): function get_error() { return new Error('my error')

[PHP-DEV] [RFC][Vote] Typed Properties

2016-05-19 Thread Joe Watkins
Morning internals, Since we have our answer on nullable types, typed properties can now go to vote. https://wiki.php.net/rfc/typed-properties#vote Note that, support for nullability as RFC'd will be merged when the implementation for nullable_types is merged into master. Please