Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88942 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15194 invoked from network); 26 Oct 2015 12:11:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Oct 2015 12:11:07 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.223.176 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.223.176 mail-io0-f176.google.com Received: from [209.85.223.176] ([209.85.223.176:33205] helo=mail-io0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/02-02627-8581E265 for ; Mon, 26 Oct 2015 07:11:04 -0500 Received: by iodd200 with SMTP id d200so20488490iod.0 for ; Mon, 26 Oct 2015 05:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zend_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RN4BBBNdtQAglbtOnfnJz9qd1YLgm2iZDgypeK+hN7M=; b=TDdTgKYJ8S3FtxVMGZjxT5sbdTsUTaSVhv8iFlkm+kudy7E7YzwynwTrzJvRJZu64C PVU4TO/Emf118gVpa4JorGM4tGShLIRuqXARN4EkcP0/M5F5WWKeGqR5Jdc4XhfNxBXW BG5qLqLqZ5aiLA4mYlnvd04HL2uP2IxZwjNHk3ml88yWqHbgCRVvl3Qp6Ri5ZJNqVKp5 5doL/fSFUM1uVzU7sksUDAiGGn0qlr12FE1LH9cnDogBO5fI7fWAcVb6iCv1L6oFIndv Je8mBNSW5w/1c8IAZFLgjWj52xlwtBG07gjM9L2Y3knz7CsEZlujVxRBJNnVyTdZYDqS NA3A== 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:date :message-id:subject:from:to:cc:content-type; bh=RN4BBBNdtQAglbtOnfnJz9qd1YLgm2iZDgypeK+hN7M=; b=AAGLSk93brisParSpWf6wksxKKR5B2xeqhQW8WFh5St3vvEGlx8w5zhvQxiVaQzBQO hHmQMzn6tljPud3D3Jcpzwi7YP2UHv2oxIc5Y4DDbeC1WDPNJolm3vjmE/g8ADkxAgcu yUaelFOKtw7WipvMnMfqmlloq5KeCyFlNMIc6trMmkl5/b6oqhMIwygFmK8TH1COJP+w qXuDpLNLXVoix+WFcNMhYsuec7w8NtC7FdUNQeBsxZVsSrScw9guQXfisH8QReX3/LIb Tn5nGEpHO4jyqNjA5Vy+TezBjP2ooibsLxv6y0HB2j5c3NsGltKLVocOd2n4ixoCzPzg UnTw== X-Gm-Message-State: ALoCoQn0ZcGM2WbMKumtjQuIlfqZIbL8SvvPDwmyl4ghZu5qZC7VA7Ev7lz/iKR056LZ1WYTMfjXUxAxVhOMwO7BcGKtIQ44RGJc2Y55PjvNYboIZIafn74G6UTaeUgR4qETEkRU0mvLRxjw6WMY0C1Xksf6ZqmKMEvuVH407pJcL32VlPG0Ppo= MIME-Version: 1.0 X-Received: by 10.107.8.218 with SMTP id h87mr41717431ioi.116.1445861460730; Mon, 26 Oct 2015 05:11:00 -0700 (PDT) Received: by 10.50.73.166 with HTTP; Mon, 26 Oct 2015 05:11:00 -0700 (PDT) In-Reply-To: References: Date: Mon, 26 Oct 2015 15:11:00 +0300 Message-ID: To: Xinchen Hui Cc: Derick Rethans , Bob Weinand , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=001a113f910ac30726052300dab5 Subject: Re: [PHP-DEV] Issues with exceptions and overloading opcodes From: dmitry@zend.com (Dmitry Stogov) --001a113f910ac30726052300dab5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I'm going to re-fix the problem with the following patch: https://gist.github.com/dstogov/1eb77a9f2ff7dd807dd1 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-example >> > >>>> with a test case ( >> > >>>> >> https://github.com/derickr/php-minimal-opcode-overloading-example/blob/m= aster/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 = 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 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 alw= ays >> > >> 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_RE= TURN >> && 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/ > --001a113f910ac30726052300dab5--