Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79400 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77748 invoked from network); 3 Dec 2014 21:10:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Dec 2014 21:10:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:39847] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/47-15597-24C7F745 for ; Wed, 03 Dec 2014 16:10:26 -0500 Received: by mail-wg0-f48.google.com with SMTP id y19so20826581wgg.21 for ; Wed, 03 Dec 2014 13:10:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=UlkJF4nYmO2yRmwwHOO3/sYvwZqNlARuPUPnewCH//I=; b=vyzN4G9fOnbgIkzmuCUeXNX1vCVAW0nw/oiAMbmVJrwt/iviO9hh+57tkWR27Aqmny gvIIvkiuC1AAI/7Us50MbScgH2OcIDjfDuPVji2S5pgT7zS6ps8FOQIHD5/0RmeSy0h2 KwckYNNG3HRi8aGsdrlqbhTglg8oUz3xZgkOg9DLINGwjb7T3YC6+yc1ccC3NQ1Z342C 47HbzrdhApkDUZMG64lihhMN6TVfWH0VF4UbUcOepmkzSL9wT2wlZz2CPsILWcafJYn1 iurf6IeHyKAwbz7cJFn+SDEpu7VUab5Q1bg8qpFvNfsEhtxPpWUPfAd7Un+PVrw1fKSf 8b9w== X-Received: by 10.180.72.199 with SMTP id f7mr16477577wiv.58.1417641022886; Wed, 03 Dec 2014 13:10:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.27.47.137 with HTTP; Wed, 3 Dec 2014 13:09:42 -0800 (PST) In-Reply-To: <547F741D.6030507@gmx.de> References: <547F741D.6030507@gmx.de> Date: Wed, 3 Dec 2014 21:09:42 +0000 Message-ID: To: Christoph Becker Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d0434c0ba969b47050956455f Subject: Re: [PHP-DEV] Conversion of SplFileInfo instances to boolean From: petercowburn@gmail.com (Peter Cowburn) --f46d0434c0ba969b47050956455f Content-Type: text/plain; charset=UTF-8 On 3 December 2014 at 20:35, Christoph Becker wrote: > Hello internals, > > today I stumbled over issue #65213[1] which has been reported as a bug, > but was changed to a feature request without any hint why the conversion > of SplFileInfo instances to boolean throws a catchable fatal error. > > Even worse, due to optimizations in OPcache (and maybe other optimizers > as well), this does not always happen. Consider the following snippet: > > > $o = new SplFileObject('.'); > if (!$o) { > } else { > var_dump(!$o); > } > > Without any optimization this throws the error in line 4 (the if > clause); with OPcache the error is thrown in line 6. Apparently that is > caused by a optimization where BOOL_NOT,JMPZ is converted to NOP,JMPNZ[2]. > > IOW: with OPcache enabled `if (!$o)` works fine, but without OPcache it > is an error. IMHO both should behave identically. > > [1] > This looks fixed in master (https://github.com/php/php-src/commit/8904f72 ). > [2] < > http://lxr.php.net/xref/PHP_5_5/ext/opcache/Optimizer/block_pass.c#816> > > -- > Christoph M. Becker > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --f46d0434c0ba969b47050956455f--