Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88917 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95318 invoked from network); 22 Oct 2015 02:44:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2015 02:44:22 -0000 Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.41 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.213.41 mail-vk0-f41.google.com Received: from [209.85.213.41] ([209.85.213.41:33980] helo=mail-vk0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/55-55035-38D48265 for ; Wed, 21 Oct 2015 22:44:20 -0400 Received: by vkat63 with SMTP id t63so39564338vka.1 for ; Wed, 21 Oct 2015 19:44: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=KUkTcP/yJ4a7yT1hkyi9wRhgoH4boJYor79G4mFnz4c=; b=QIr809lRe95zeKqCNzKhACNfQhHbNe4zXsswXxHTYHarL/pJFVND/V4QgAzNnBnc9n PADD5U+14lSvbKdhlybM+IYNUlZuLxhsWZkFxOzTmUAqRjZyVo3hvtKsZRnqp6L97YsK qazjS7eb0DFKDRiUhIPmwdEuPTic6JMwULsxlUEKXHNZUI5psL+UQkrCJVMyDg7oJtp3 SkdBK9PC0+uME0M2/QSWrc/UZyRBtJJWYkPSmqb9tghWmpxdrIyK/TQ+xJyYsbXKIMm3 mnxfFRp/PZu8td7ywip8XdjqSo6FhPER6GM1iDscIT51H2mHdO5DWpirPae7jflJRBlU YDiw== X-Gm-Message-State: ALoCoQmcx+USsitTK9gUilHddHyuu5s8frnu9ORuzUJ51scM8NyeDzdNhg0/C12QWaDppIpoOnZBbyq0M9N/BP9BO8QaO+pKKnvFej6FN0vMB5o5MQe56FhZA4phJtiuqse+TGcSVJgeMq1/xHBL2DxqbjIk+tKkO4ZmqULsudH6sfFT6aO+jTU= X-Received: by 10.31.149.149 with SMTP id x143mr7770254vkd.12.1445481856340; Wed, 21 Oct 2015 19:44:16 -0700 (PDT) Received: from mail-vk0-f47.google.com (mail-vk0-f47.google.com. [209.85.213.47]) by smtp.gmail.com with ESMTPSA id v7sm2252863vkd.20.2015.10.21.19.44.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 19:44:15 -0700 (PDT) Received: by vkex70 with SMTP id x70so39404125vke.3 for ; Wed, 21 Oct 2015 19:44:15 -0700 (PDT) X-Received: by 10.31.130.9 with SMTP id e9mr2703026vkd.78.1445481855141; Wed, 21 Oct 2015 19:44:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.229.3 with HTTP; Wed, 21 Oct 2015 19:43:55 -0700 (PDT) In-Reply-To: References: Date: Thu, 22 Oct 2015 10:43:55 +0800 Message-ID: To: Derick Rethans Cc: Bob Weinand , Dmitry Stogov , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=001a1145a428814e9b0522a8784c Subject: Re: [PHP-DEV] Issues with exceptions and overloading opcodes From: laruence@php.net (Xinchen Hui) --001a1145a428814e9b0522a8784c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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-example > > >>>> with a test case ( > > >>>> > https://github.com/derickr/php-minimal-opcode-overloading-example/blob/ma= ster/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. And > > >> 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 i= n > > >> 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 actually > > >> 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 alwa= ys > > >> 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_RET= URN > && 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 --=20 Xinchen Hui @Laruence http://www.laruence.com/ --001a1145a428814e9b0522a8784c--