Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72244 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49472 invoked from network); 5 Feb 2014 07:17:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2014 07:17:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.115 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.115 smtp115.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.115] ([108.166.43.115:40859] helo=smtp115.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/42-22810-2A5E1F25 for ; Wed, 05 Feb 2014 02:17:56 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp7.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 4B48F1B8129; Wed, 5 Feb 2014 02:17:52 -0500 (EST) X-Virus-Scanned: OK Received: by smtp7.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id EE0D81B8128; Wed, 5 Feb 2014 02:17:51 -0500 (EST) Message-ID: <52F1E58F.3050105@sugarcrm.com> Date: Tue, 04 Feb 2014 23:17:35 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Yasuo Ohgaki CC: PHP internals References: <52EE2B66.4040005@pthreads.org> <52F157BE.3020804@ajf.me> <52F15FD6.7060901@ajf.me> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RE: RFC: expectations/assertions From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! >> php > assert('function() {return FALSE;}'); >> php > assert('function() {return TRUE;}'); This runs function() code, which produces a closure. The closure is not false, so assert is not fired. >> php > assert(eval('function() {return FALSE;};')); The eval here returns NULL (http://3v4l.org/cPpgj) so of course assert will be fired here. From eval's manual: eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. Compare: http://3v4l.org/vhe1p http://3v4l.org/B79r3 >> Warning: assert(): Assertion failed in php shell code on line 1 >> >> so closure in eval() works. I don't see reason not to allow closure Did you try: assert(eval('function() {return TRUE;};')); Testing hypothesis usually involves not only testing something that confirms it, but also something that may refute it. Otherwise you're not really testing, you are just convincing yourself. > Added this to inconsistent behaviors RFC to track. > > https://wiki.php.net/rfc/inconsistent-behaviors#assert There's no inconsistent behaviors here and IMHO this RFC is turning into "things people misunderstand in PHP". Maybe it should be moved to a blog or some other space, because it by now has very little to do with what RFCs are for. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227