Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Erik van Velzen
Thanks for your input. I did not try-catch because it doesn't really work, you either duplicate rollback code or get excessive nesting. Real code will obviously be more complicated than the examples. Also in both cases the handlers are many lines apart from the actual transaction call. Duplicate

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Johannes Schlüter
On Wed, 2015-10-28 at 11:00 +0100, Erik van Velzen wrote: > Subject says it all. > > I want to make a small "ScopeGuard" library for exception-safe > transactions, like the following: > > $scope = new ScopeGuard; > > $scope->onSucces(function() { logTransactionOne(); }); >

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Erik van Velzen
I didn't see how it could be generalized but your example clears that up. - Erik 2015-10-28 15:40 GMT+01:00 Rowan Collins : > > Did you see Johannes' suggestion re explicit success vs implicit failure? > > $scope = new ScopeGuard; > > $scope->onSucces(function() {

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Rowan Collins
Erik van Velzen wrote on 28/10/2015 13:28: try { $scope = new ScopeGuard; $scope->onSucces(function() { logTransactionOne(); }); $scope->onFailure(function() { rollbackTransationOne(); }); doTransactionOne(); $scope->onSuccess(function() {

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Nikita Nefedov
Hi Erik, On Wed, 28 Oct 2015 16:28:59 +0300, Erik van Velzen wrote: Thanks for your input. I did not try-catch because it doesn't really work, you either duplicate rollback code or get excessive nesting. Real code will obviously be more complicated than the examples. Also in

[PHP-DEV] Re: Speed up fetching of class entries for self:: parent:: and static:: (Bob's idea)

2015-10-28 Thread Xinchen Hui
Hey: On Wed, Oct 28, 2015 at 2:11 PM, Bob Weinand wrote: > > Am 28.10.2015 um 05:20 schrieb Dmitry Stogov : > > What is the general impression from the patch? > Should we commit it (with minor fixes and/or additional optimisations)? > Bob, do you see

[PHP-DEV] Re: Speed up fetching of class entries for self:: parent:: and static:: (Bob's idea)

2015-10-28 Thread Bob Weinand
> Am 28.10.2015 um 05:20 schrieb Dmitry Stogov : > What is the general impression from the patch? > Should we commit it (with minor fixes and/or additional optimisations)? > Bob, do you see performance improvement on your app? > > Thanks. Dmitry. > > On Oct 27, 2015 4:14 PM,

RE: [PHP-DEV] Re: [PHP-CVS] com php-src: Remove arc4random: ext/standard/config.m4 ext/standard/random.c

2015-10-28 Thread Anatol Belski
Hi Leigh, > -Original Message- > From: Leigh [mailto:lei...@gmail.com] > Sent: Tuesday, October 27, 2015 10:37 AM > To: Anatol Belski > Cc: Leigh ; php-...@lists.php.net; PHP Internals > > Subject: [PHP-DEV] Re: [PHP-CVS]

[PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Erik van Velzen
Subject says it all. I want to make a small "ScopeGuard" library for exception-safe transactions, like the following: $scope = new ScopeGuard; $scope->onSucces(function() { logTransactionOne(); }); $scope->onFailure(function() { rollbackTransationOne(); }); doTransactionOne();

[PHP-DEV] Benchmark Results for PHP Master 2015-10-28

2015-10-28 Thread lp_benchmark_robot
Results for project PHP master, build date 2015-10-28 16:24:19+02:00 commit: ff0ec065623a7563cc9a99586a9cb2f351f3cbfa revision date: 2015-10-28 12:56:26+01: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] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Rowan Collins
Erik van Velzen wrote on 28/10/2015 15:02: The ScopeGuard's destructor can now detect the condition: if ( $this->success_registered ) { // Function reached checkpoint for this scope $this->callSuccessHandlers(); } else { // Function aborted early, due to a throw or early return

[PHP-DEV] Re: Debugings another Drupal PHP 7 failure

2015-10-28 Thread James Gilliland
wrapping the service container code that is triggering this bug with gc_disable() and gc_enable() or calling gc_collect_cycles() before its run seems to "fix" the segfault which seems to suggests a garbage collection problem. On Wed, Oct 28, 2015 at 12:13 PM James Gilliland

[PHP-DEV] Debugings another Drupal PHP 7 failure

2015-10-28 Thread James Gilliland
So in an effort to fully support PHP 7 out of the box with the eminent release of Drupal 8, we're trying to track down some segmentation faults in our testing infrastructure. One that seems to be causing a lot of failures is listed here. https://bugs.php.net/bug.php?id=70805 Does anyone have any

[PHP-DEV] Re: Speed up fetching of class entries for self:: parent:: and static::(Bob's idea)

2015-10-28 Thread Andrea Faulds
Hi Dmitry, Dmitry Stogov wrote: Please take a look: https://github.com/php/php-src/pull/1604 The speed improvement on real-life is insignificant. VM size is increased by 10KB. I don't have a strong opinion, if this should go into master or not. 10KB VM size increase for insignificant

Re: [PHP-DEV] [VOTE] Void Return Type RFC

2015-10-28 Thread François Laupretre
Hi Andrea, Le 29/10/2015 01:08, Andrea Faulds a écrit : The vote can be found here: https://wiki.php.net/rfc/void_return_type#vote Just voted +1 as, unlike some :), I like the idea of distinguishing void from null. Is it too late to add a note in the RFC, listing the possibility, in the

Re: [PHP-DEV] [VOTE] Void Return Type RFC

2015-10-28 Thread Levi Morrison
On Wed, Oct 28, 2015 at 8:17 PM, François Laupretre wrote: > Hi Andrea, > > Le 29/10/2015 01:08, Andrea Faulds a écrit : >> >> >> The vote can be found here: >> >> https://wiki.php.net/rfc/void_return_type#vote > > > Just voted +1 as, unlike some :), I like the idea of

Re: [PHP-DEV] Re: Speed up fetching of class entries for self:: parent:: and static::(Bob's idea)

2015-10-28 Thread Dmitry Stogov
Hi Andrea, On Oct 28, 2015 9:06 PM, "Andrea Faulds" wrote: > > Hi Dmitry, > > > Dmitry Stogov wrote: >> >> Please take a look: https://github.com/php/php-src/pull/1604 >> The speed improvement on real-life is insignificant. >> VM size is increased by 10KB. >> >> I don't have a

[PHP-DEV] Support execution scope realization at runtime (or last pieces for private class support)

2015-10-28 Thread guilhermebla...@gmail.com
Hi internals! I want to revive an old patch I was working on last year, and open for discussion the last missing piece to make it fully complete, allowing me to write a RFC. Link to patch introducing support to private classes: https://github.com/php/php-src/pull/947 Currently, there's no way

Re: [PHP-DEV] [VOTE] Void Return Type RFC

2015-10-28 Thread Marcio Almada
Hi, Welcome back, Andrea! It's great to see you contributing here again :) 2015-10-28 21:08 GMT-03:00 Andrea Faulds : > Hi everyone, > > It’s been two weeks, so voting on this RFC can start. The rules are as > usual. This is a language change, so a 2/3 majority is required. > > The

[PHP-DEV] API to retrieve opcode operand and extended_value meaning

2015-10-28 Thread Dmitry Stogov
Hi, Please review the PR (for master only). It adds an API call to get information about opcode operand and extended_value meaning. This API should be useful for phpdbg, xdebug and others. Once these extension switch to new API, they will support most new opcodes out of the box.

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Johannes Schlüter
On Wed, 2015-10-28 at 16:45 +, Rowan Collins wrote: > On the downside, it's worth noting that while PHP destructors are > technically deterministic, the language can actually prevent them > running on scope exit, because Exceptions hold references to everything > used as a parameter in

Re: [PHP-DEV] Re: [PHP-CVS] com php-src: Remove arc4random: ext/standard/config.m4 ext/standard/random.c

2015-10-28 Thread Leigh
On 28 October 2015 at 09:51, Anatol Belski wrote: > Yeah, I was only talking about those two OS versions that are known for > sure to have proper implementations. Even that is a smaller community than > fe Linux, IMHO no reason to handicap users, especially as the

[PHP-DEV] RE: [PHP-CVS] Re: [PHP-DEV] Re: [PHP-CVS] com php-src: Remove arc4random: ext/standard/config.m4 ext/standard/random.c

2015-10-28 Thread Anatol Belski
> -Original Message- > From: Leigh [mailto:lei...@gmail.com] > Sent: Wednesday, October 28, 2015 11:14 PM > To: Anatol Belski > Cc: php-...@lists.php.net; PHP Internals > Subject: [PHP-CVS] Re: [PHP-DEV] Re: [PHP-CVS] com php-src: Remove

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Johannes Schlüter
On Wed, 2015-10-28 at 16:02 +0100, Erik van Velzen wrote: > I didn't see how it could be generalized but your example clears that up. Quick attempt of a generalization: abstract class AbstractRAIIGuard { private $succeeded = false; protected abstract function fail(); protected

[PHP-DEV] [VOTE] Void Return Type RFC

2015-10-28 Thread Andrea Faulds
Hi everyone, It’s been two weeks, so voting on this RFC can start. The rules are as usual. This is a language change, so a 2/3 majority is required. The vote can be found here: https://wiki.php.net/rfc/void_return_type#vote Voting starts today (2015-10-28) and will end next Sunday

[PHP-DEV] Re: [VOTE] Void Return Type RFC

2015-10-28 Thread Andrea Faulds
Hi again, Andrea Faulds wrote: Voting starts today (2015-10-28) and will end next Sunday (2015-11-08), 10 days’ time. My apologies, that should say today is the 29th, not the 28th, so 2015-10-29. Unfortunately I lost my glasses when I went to PHP North West this year, and I'd procrastinated

Re: [PHP-DEV] [VOTE] Void Return Type RFC

2015-10-28 Thread Bob Weinand
> Am 29.10.2015 um 01:08 schrieb Andrea Faulds : > > Hi everyone, > > It’s been two weeks, so voting on this RFC can start. The rules are as usual. > This is a language change, so a 2/3 majority is required. > > The vote can be found here: > >