Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88944 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19027 invoked from network); 26 Oct 2015 12:40:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Oct 2015 12:40:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.48 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.213.48 mail-vk0-f48.google.com Received: from [209.85.213.48] ([209.85.213.48:33139] helo=mail-vk0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/C2-02627-33F1E265 for ; Mon, 26 Oct 2015 07:40:19 -0500 Received: by vkgy127 with SMTP id y127so97822151vkg.0 for ; Mon, 26 Oct 2015 05:40:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=Zw1mcji1A8S1IVw7TQpJQu8xO97y6TPr3edxh5BnwGc=; b=iMYXboPq3fmfQ4lBUKqnzwFzccZjrQypTcxt3VCoCqYYeGZkQnlXfDG2M+4Q41Mgwf 4bcdCvFRdMPjd9bldnrJjoMD2PNQPYG92E8EisQwDJbAzae2W/oFzj3XqAhTYgBjdjhw JKdEQEC+JJlBpB6uXM3cPjm6DwcFyxb5SKK09gwwcyaN+UYtKXSbY/f9sqih/zxV+Qq6 q/gDwBmB4uYFgycaxSE/FclUYcVy5rNi4A5z/RPugPZ2/XJcfFjPQBw94yetoUji9zUV MFGPXJrXsUNOZEzkZM2LzfOej7lEgwxna9fHBeU+1U4/0M2SnnhqtD1bkMfs9ZUr+fHF SoxA== X-Gm-Message-State: ALoCoQkg91ysQxL/+aqcrEPCHnCVKuQIO7jtRSLZuCHj+19WzazftOWtnYe5vdAfogkBgLnQkN1M/rQmdoBGsccewfR0sfj6uOVUQmSAAC0hEu9JTXsNk/IsPtleToRPNccuuwZuwd7u3EUlCHCh4dCGjtzBS/TINRKKOr/nChKRpwFvOTX9dQM= X-Received: by 10.31.159.208 with SMTP id i199mr24947056vke.74.1445863216358; Mon, 26 Oct 2015 05:40:16 -0700 (PDT) Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com. [209.85.213.48]) by smtp.gmail.com with ESMTPSA id f63sm6258054vka.0.2015.10.26.05.40.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2015 05:40:15 -0700 (PDT) Received: by vkex70 with SMTP id x70so96895681vke.3 for ; Mon, 26 Oct 2015 05:40:15 -0700 (PDT) X-Received: by 10.31.165.132 with SMTP id o126mr24934354vke.101.1445863215210; Mon, 26 Oct 2015 05:40:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.229.3 with HTTP; Mon, 26 Oct 2015 05:39:55 -0700 (PDT) In-Reply-To: References: Date: Mon, 26 Oct 2015 20:39:55 +0800 Message-ID: To: Dmitry Stogov Cc: Derick Rethans , Bob Weinand , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=001a114162c2562ae90523014344 Subject: Re: [PHP-DEV] Issues with exceptions and overloading opcodes From: laruence@php.net (Xinchen Hui) --001a114162c2562ae90523014344 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hey: On Mon, Oct 26, 2015 at 8:11 PM, Dmitry Stogov wrote: > Hi, > > I'm going to re-fix the problem with the following patch: > > https://gist.github.com/dstogov/1eb77a9f2ff7dd807dd1 > thanks, sorry I was busy last week, plan to do it tonight, but seems you already fixed it. :) thanks > > > Thanks. Dmitry. > > On Thu, Oct 22, 2015 at 5:43 AM, Xinchen Hui wrote: > >> Hey: >> >> >> >> On Wed, Oct 21, 2015 at 10:38 PM, Derick Rethans wrote: >> >>> On Tue, 20 Oct 2015, Bob Weinand wrote: >>> >>> > > Am 20.10.2015 um 18:08 schrieb Derick Rethans : >>> > > >>> > > On Tue, 20 Oct 2015, Bob Weinand wrote: >>> > > >>> > >>> Am 20.10.2015 um 17:11 schrieb Xinchen Hui : >>> > >>> >>> > >>> On Tue, Oct 20, 2015 at 10:45 PM, Derick Rethans >> > wrote: >>> > >>> >>> > >>>> When hacking on Xdebug for PHP 7, I ran into some issues where >>> > >>>> PHP would just spin around. This happens when there is an >>> > >>>> exception, and I use overloaded opcodes. I wrote a small example >>> > >>>> extension at >>> > >>>> https://github.com/derickr/php-minimal-opcode-overloading-exampl= e >>> > >>>> with a test case ( >>> > >>>> >>> https://github.com/derickr/php-minimal-opcode-overloading-example/blob/= master/tests/test.php >>> > >>>> ) that shows that something is looping in executing opcodes, as >>> > >>>> the HANDLE_EXCEPTION iirc doesn't advance to the next opline. I >>> > >>>> believe this is a recent enough change, as it only started >>> > >>>> happening after I upgraded from about RC1 to latest master. >>> > >>>> >>> > >>>> Would you care to have a look? >>> > >>>> >>> > >>> This is introduced by a fix made by Bob, >>> > >>> https://github.com/php/php-src/commit/808f62bb >>> > >>> >>> > >>> >>> > >>> Bob, I am going to revert this for now, since you didn't include = a >>> > >>> test script to show where the problem was, I am not sure why you >>> > >>> made this? >>> > >> >>> > >> I didn't add any test case as we don't have any APIs in php-src >>> > >> using that user_opcode handler. I discussed the change back then >>> > >> with Dmitry and committed with his review. >>> > >> >>> > >> It concretely broke uopz which might throw an exception itself. An= d >>> > >> in turn we realized that for integrity we need to ensure that >>> > >> opline =3D=3D EX(opline) else we'll end up with different behavior= in >>> > >> global register builds and normal builds. >>> > >> >>> > >> In general, you should not overload ZEND_HANDLE_EXCEPTION (if you >>> > >> need to, have a special handling for it, but never directly >>> > >> dispatch to it). It is quite special being the only opcode actuall= y >>> > >> allowing EG(exception) to be non-NULL at the start of it. >>> > >> >>> > >> You are doing an #ifdef ZTS to exempt it=E2=80=A6 why don't you al= ways >>> > >> exempt it? >>> > > >>> > > Even if I do (like I've just pushed into the extension), the test >>> > > still fails because the code loops. So you did break something. >>> > >>> > Ah, ZEND_CATCH indeed also allows EG(exception) to be non-null=E2=80= =A6 >>> > >>> > =E2=80=A6 maybe I should write >>> > >>> > if (EG(exception) >>> > && opline->opcode !=3D ZEND_HANDLE_EXCEPTION && opline->opcode !=3D >>> ZEND_CATCH >>> > && ret !=3D ZEND_USER_OPCODE_DISPATCH && ret !=3D ZEND_USER_OPCODE_R= ETURN >>> && ret !=3D ZEND_USER_OPCODE_ENTER && ret !=3D ZEND_USER_OPCODE_LEAVE) = { >>> > HANDLE_EXCEPTION(); >>> > } >>> > >>> > to allow dispatching for these two opcodes too? >>> >>> I don't know. Dmitry, Xinchen? I'd like to get this resolved soon.. >>> >>> The commit which cause this problem has been reverted, so this is >> resolved , and regarding the problem which is commit tried to fixed, we >> will find a better way to re-fix that. >> >> thanks >> >>> cheers, >>> Derick >> >> >> >> >> -- >> Xinchen Hui >> @Laruence >> http://www.laruence.com/ >> > > --=20 Xinchen Hui @Laruence http://www.laruence.com/ --001a114162c2562ae90523014344--