Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87237 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16716 invoked from network); 22 Jul 2015 19:31:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2015 19:31:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.172 as permitted sender) X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 209.85.213.172 mail-ig0-f172.google.com Received: from [209.85.213.172] ([209.85.213.172:38384] helo=mail-ig0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/E3-27316-58FEFA55 for ; Wed, 22 Jul 2015 15:31:17 -0400 Received: by iggf3 with SMTP id f3so141010344igg.1 for ; Wed, 22 Jul 2015 12:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Te4OH3zKhnfE8e+16Bxq76Gd0hFlhyquoq9CQgmWv8c=; b=BfIP6hCQpIJ0CqnXjKsd/I/7kyA7fT336qt57iV+ZMaQ6ypVDXoA5HbAjhvWg8HjFU PCenNllSGFlVtxM22z0AguP6Q8HhXIvmnLY0dx+8pZpXN7DUwBG1okVy+Ut2B5os5AJ8 wH3WKoMC8wRUynkHry7fOTIh3/guU1v3SUr2mDAMK5ktVaPOReZFKIB2uOxhqoqNwVuh ZhwYKIJ2rWPesVtLiXy3ZyfEJwWUSu6/hRZ7TrSQudl+Ri0CEFIqrGENQT228tr5UvxD i/vmZpXRcU6IHeUan8x4VlZUJJugTC2S50AkMUTQA48XW5WM4GpSv+Dl6TxUET2G1HC6 Yjlw== MIME-Version: 1.0 X-Received: by 10.107.134.193 with SMTP id q62mr7586044ioi.91.1437593425748; Wed, 22 Jul 2015 12:30:25 -0700 (PDT) Sender: dmgx.michael@gmail.com Received: by 10.36.26.20 with HTTP; Wed, 22 Jul 2015 12:30:25 -0700 (PDT) In-Reply-To: <55AE8515.7050905@gmail.com> References: <55AE8515.7050905@gmail.com> Date: Wed, 22 Jul 2015 15:30:25 -0400 X-Google-Sender-Auth: r5Yc9AFoTBf3Yk4ijTqp-qAeKvo Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001a113f8eee7aecbd051b7bcd07 Subject: Re: [PHP-DEV] List of possible E_RECOVERABLE_ERRORs From: tendoaki@gmail.com (Michael Morris) --001a113f8eee7aecbd051b7bcd07 Content-Type: text/plain; charset=UTF-8 I was provided with such a grep of PHP 5.6 and have begun the mapping. I've set up this composer package for it. https://packagist.org/packages/aki-tendo/php7exception and the git if someone has some time to chip in. https://github.com/TendoAki/php-7-exceptions-in-php-5 Currently I have AssertionError mapped since that is dirt simple to do. From here out it's a bit more unclear. Now, the main goal here is to make the @expectedException annotation work the same way in PHP 5 and 7 for these errors. That said, how many of these will actually get units aimed at them? Probably not many. My first thought is to strpos the message string for the word "Argument" and if that returns 0 then I know it's a TypeError and can throw that. Apparently eval() can raise E_RECOVERABLE, so that maps to ParseError. All others to Error? I would appreciate some guidance on this - smoothing the transition from 5 to 7 helps all of us. On Tue, Jul 21, 2015 at 1:44 PM, Rowan Collins wrote: > Michael Morris wrote on 21/07/2015 18:11: > >> Hi. I hate to ask an outright question on the list rather but I've been >> searching the last 5 hours for an answer to this and haven't found >> anything >> and it's a rather tight corner case. I'm working on a small package for >> PHP >> 5.x that uses set_error_handler() to convert E_RECOVERABLE_ERRORs to the >> appropriate PHP 7 exceptions. I know I can't emulate things exactly - my >> goal is to get things so that PHPUnit tests can use the same >> @expectedException annotation for these scenarios, simplifying unit test >> writing. >> >> As far as my research has found E_RECOVERABLE_ERROR has only ever been >> used >> for type hint failures. Are there any other errors that have this type, >> and if so to what PHP 7 exception should they be converted? >> >> > You should be able to figure out with a grep of the source code for use of > that constant (it has the same name in C as in PHP). A quick glance on > lxr.php.net shows a few other uses: > http://lxr.php.net/search?q=&defs=&refs=E_RECOVERABLE_ERROR&path=&hist=&project=PHP_5_6 > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a113f8eee7aecbd051b7bcd07--