Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98900 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89442 invoked from network); 28 Apr 2017 19:30:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2017 19:30:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.45 mail-wm0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:36354] helo=mail-wm0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/C1-01540-73893095 for ; Fri, 28 Apr 2017 15:30:00 -0400 Received: by mail-wm0-f45.google.com with SMTP id u65so50197669wmu.1 for ; Fri, 28 Apr 2017 12:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=/G9KIBCJ0BGGrpotiHH23h3sxKWazMKpbjq/txatkuw=; b=ffRjTJKsXHd/9n1r5rsDGvze3YCRRaPQvX2LUS6G47/0dBedv82eBVLM4SikobROvJ 12t/jcNL5mOHllQrYAL8kAaJg1LCaE6oBN4GbWHJVLVXCuRaHCuM/QhTnGB/BezzJPBy M9xJklXUMCzw4ns39A7Vljj1TzKlDHWXfYgC8OnFuQrYPGPL+Yc4Y7IGQOslUjkRxXr5 TWKx9nSN6ELnLEgRjgYlOifFoFiFbZWUshipxuCxMoDsrl5Yjtg10UI6nBOPEAqRvkPj TFyWUVz3afUTslfNIB15YWsP/yss67pRJVAsmPEkp2SVhVjN8uejr8YVOVji26t5P942 pRgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=/G9KIBCJ0BGGrpotiHH23h3sxKWazMKpbjq/txatkuw=; b=PehtirElo9VUbZAjhfyZXbGSMDQAf5b1bc/mVxKdsSX8yYPgY2EPFKhCNGWn5AV6Tx vWo+1d3gL03D0h6z9eJc4biTkdQUB8yckL7ISGJIXRgSnImwYawooqgrxV2aeplq6l3S +geR+m0JO98t8wasEHeG0ytLVRc0SGQPlOnRU0YD21CyqPG4O24Md52IBM0jBAEcncdm rep3eSsFzTd6Z2T/QCN5FgFb+xF7KMUfd80TEn8f9LnK8p5e7mAy1IhmTZRVanyFpLq4 vd3V2U5USvCbxKem4wo7oh94Izv5bpPAx3M4l6rT4VE0iqsIwQcD5bocSpLBbxnmHUf0 ZfGA== X-Gm-Message-State: AN3rC/53tA9EBvk2nOssEcD8eSIBtIf59p2LOyMZzQcElO3k7ihL7hPT dl0mNV/vC/Xda0/4WS0= X-Received: by 10.28.225.212 with SMTP id y203mr7083272wmg.62.1493407796223; Fri, 28 Apr 2017 12:29:56 -0700 (PDT) Received: from [10.61.139.48] (188.29.164.128.threembb.co.uk. [188.29.164.128]) by smtp.gmail.com with ESMTPSA id g25sm10375224wra.1.2017.04.28.12.29.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Apr 2017 12:29:54 -0700 (PDT) Date: Fri, 28 Apr 2017 20:29:52 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net Message-ID: <398456D8-170A-4629-B6FF-D64F6DDB9C9A@gmail.com> Subject: Re: [PHP-DEV] [RFC] Enable strict_types checking for curl_setopt() From: rowan.collins@gmail.com (Rowan Collins) On 28 April 2017 18:54:09 BST, Sara Golemon wrote: >On Fri, Apr 28, 2017 at 9:34 AM, Markus Fischer >wrote: >> To me the intention of strict types is clearly on the functions >publicly >> visible contract, i=2Ee=2E it's reflectable parameters and not some >business >> logic hidden inside a function=2E >> >So you feel that declare(strict_types=3D1); should never apply to >internal functions? I don't see that assertion implied in any of the objections on this thread= =2E The objection is that type checking currently only occurs at function b= oundaries: their signatures are matched against provided parameters, and th= eir return declarations against returned values=2E The entire feature is eq= uivalent to the compiler injecting either casts (weak mode) or assertions (= strict mode) at the beginning and end of function definitions, *and nowhere= else*=2E This RFC introduces a check at a different point in the function: after th= e parameters have been examined, based not on the signature of the function= , but an internal set of rules=2E Notably, this is not a type of check that could be made in a userland func= tion - or, rather, it would have to be made unconditionally, since the stri= ct_types setting is explicitly invisible to the callee=2E So, while I agree that checking the argument types for curl_setopt() is hi= ghly desirable, I am sympathetic to the argument that strict_types should n= ot alter those checks=2E That leaves us with either checking the types unconditionally (a significa= ntly breaking change) or introducing a new, type-safe, API=2E That could me= an a small but awkward set of type overloads (setBool, setInt, etc), or a l= arge set of named setters (setReturnTransfer, setHeaders, etc) which could = use normal parameter hinting to interact with strict_types=2E As I mentioned, I think the entire PHP curl API is unnecessarily complicat= ed to use, and the overloading of parameter types in curl_setopt actually c= ontributes to this rather than simplifying anything=2E Regards, --=20 Rowan Collins [IMSoP]