Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98458 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34311 invoked from network); 9 Mar 2017 17:37:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2017 17:37:57 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.164 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.164 mx208.easyname.com Received: from [212.232.25.164] ([212.232.25.164:39203] helo=mx208.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/60-31244-4F291C85 for ; Thu, 09 Mar 2017 12:37:56 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cm20d-0006U2-Do; Thu, 09 Mar 2017 17:37:53 +0000 Reply-To: internals@lists.php.net References: To: Stanislav Malyshev , Andrey Andreev , "internals@lists.php.net" Message-ID: <3b1ab2d7-c572-14a7-da37-d5b7e379326e@fleshgrinder.com> Date: Thu, 9 Mar 2017 18:37:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] [Discussion] is_string(), string type and objects implementing __toString() From: php@fleshgrinder.com (Fleshgrinder) On 3/9/2017 3:18 AM, Stanislav Malyshev wrote: > Hi! > >> I submitted a GitHub PR* to allow objects implementing __toString() to >> *optionally* pass is_string() validation. More verbose wording of my >> motivation can be seen in the PR description, but here are the main >> points: > > I don't think it's right approach. is_* functions check the current type > of the value, not whether it can be converted to another type. If we > need ones that express the latter, we should have different functions. > > Also, as already noted, having __toString doesn't mean it returns > something useful. > This is not true at all: 1. is_dir 2. is_executable 3. is_file 4. is_finite 5. is_infinite 6. is_link 7. is_nan 8. is_readable 9. is_resource (checks the resource's type too) 10. is_uploaded_file 11. is_writable All other `is_*` functions are either checking the type or the instance of an object in some way. -- Richard "Fleshgrinder" Fussenegger