Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42678 invoked from network); 20 Oct 2015 16:08:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2015 16:08:36 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:42880] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/89-54881-30766265 for ; Tue, 20 Oct 2015 12:08:35 -0400 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 4724010C01F; Tue, 20 Oct 2015 17:08:26 +0100 (BST) Date: Tue, 20 Oct 2015 17:08:26 +0100 (BST) X-X-Sender: derick@whisky.home.derickrethans.nl To: Bob Weinand cc: Xinchen Hui , Dmitry Stogov , PHP Developers Mailing List In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1460028233-1445357311=:10651" Subject: Re: [PHP-DEV] Issues with exceptions and overloading opcodes From: derick@php.net (Derick Rethans) --8323329-1460028233-1445357311=:10651 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 20 Oct 2015, Bob Weinand wrote: > > Am 20.10.2015 um 17:11 schrieb Xinchen Hui : > >=20 > > On Tue, Oct 20, 2015 at 10:45 PM, Derick Rethans > wrote: > >=20 > >> When hacking on Xdebug for PHP 7, I ran into some issues where PHP=20 > >> would just spin around. This happens when there is an exception,=20 > >> and I use overloaded opcodes. I wrote a small example extension at=20 > >> https://github.com/derickr/php-minimal-opcode-overloading-example=20 > >> with a test case (=20 > >> https://github.com/derickr/php-minimal-opcode-overloading-example/blob= /master/tests/test.php=20 > >> ) that shows that something is looping in executing opcodes, as the=20 > >> HANDLE_EXCEPTION iirc doesn't advance to the next opline. I believe=20 > >> this is a recent enough change, as it only started happening after=20 > >> I upgraded from about RC1 to latest master. > >>=20 > >> Would you care to have a look? > >>=20 > > This is introduced by a fix made by Bob,=20 > > https://github.com/php/php-src/commit/808f62bb=20 > > > >=20 > > Bob, I am going to revert this for now, since you didn't include a=20 > > test script to show where the problem was, I am not sure why you=20 > > made this? > > I didn't add any test case as we don't have any APIs in php-src using=20 > that user_opcode handler. I discussed the change back then with Dmitry=20 > and committed with his review. >=20 > It concretely broke uopz which might throw an exception itself. And in=20 > turn we realized that for integrity we need to ensure that opline =3D=3D= =20 > EX(opline) else we'll end up with different behavior in global=20 > register builds and normal builds. >=20 > In general, you should not overload ZEND_HANDLE_EXCEPTION (if you need=20 > to, have a special handling for it, but never directly dispatch to=20 > it). It is quite special being the only opcode actually allowing=20 > EG(exception) to be non-NULL at the start of it. >=20 > You are doing an #ifdef ZTS to exempt it=E2=80=A6 why don't you always ex= empt=20 > it? Even if I do (like I've just pushed into the extension), the test still=20 fails because the code loops. So you did break something. cheers, Derick --8323329-1460028233-1445357311=:10651--