Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70922 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34827 invoked from network); 30 Dec 2013 17:22:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Dec 2013 17:22:44 -0000 Authentication-Results: pb1.pair.com header.from=php@marc-bennewitz.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@marc-bennewitz.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain marc-bennewitz.de from 80.237.132.171 cause and error) X-PHP-List-Original-Sender: php@marc-bennewitz.de X-Host-Fingerprint: 80.237.132.171 wp164.webpack.hosteurope.de Received: from [80.237.132.171] ([80.237.132.171:60508] helo=wp164.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/30-33070-3EBA1C25 for ; Mon, 30 Dec 2013 12:22:44 -0500 Received: from dslb-088-072-016-042.pools.arcor-ip.net ([88.72.16.42] helo=[192.168.178.27]); authenticated by wp164.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1VxgY4-0005Gv-Bg; Mon, 30 Dec 2013 18:22:40 +0100 Message-ID: <52C1ABDF.7080100@marc-bennewitz.de> Date: Mon, 30 Dec 2013 18:22:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;php@marc-bennewitz.de;1388424164;0ba825d4; Subject: Re: [PHP-DEV] GMP and empty() From: php@marc-bennewitz.de (Marc Bennewitz) Hi, because in my world the following operations should be the same: (expect that "empty" doesn't trigger a warning in an unknown variable) $v = gmp_init("0"); if (!$v) {} if ($v != true) {} if ($v == false) {} if (empty($v)) {} ... so in my world "empty" should be handled the same as "$v == false" and such comparison operation is possible to define by the GMP object if it's not already. Thoughts? Marc Am 29.12.2013 09:04, schrieb Yasuo Ohgaki: > Hi all, > > GMP '0' object does not evaluated as empty() > > $ ./php-bin -r '$v = gmp_init("0"); var_dump(empty($v), $v == 0);' > bool(false) > bool(true) > > This may cause confusion and bugs in user scripts. > > Most math functions does not work with GMP object neither. > We might be better to raise warning for math functions that > do not support GMP object. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net >