Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86765 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24688 invoked from network); 21 Jun 2015 16:27:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2015 16:27:07 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lerdorf.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.179 mail-qk0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:34548] helo=mail-qk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/12-06847-7D5E6855 for ; Sun, 21 Jun 2015 12:27:06 -0400 Received: by qkeo142 with SMTP id o142so71578332qke.1 for ; Sun, 21 Jun 2015 09:27:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type; bh=muFRaK6s7WDdzvwja70WS4vJ46W7tB+MtYnP9ANXHZM=; b=Zkh8qDzRhW17DGaoXnJqqEt4sK5stoxP9EcpLLU0x5vulvLcQfs3DEF2qqS6ahKua9 7ydckzlg1oua3RNZR7MKis7kISMhHMvkX5ZG2L36jJFzvjaFUMcChmfytglNuq0W+wuh GqnHRrDBb3BRmpxfwEGpK2UwhddTdEExl9B0f0ADtNgNdPEXkreMhvwm/g6Wx50jnbQs lp/F5wqdYNyOPRvSZSvFvUe6vKkGNkpuE6vLh02nFPvG3tejj5KP9mkBfQizeOR85e1M 1e8r8vkk/09GzJnb0ayXKgovV69LcwG/dy1hyw+WOXctcXrahWJCF8Gkg/TAa3TMRVDi zHtQ== X-Gm-Message-State: ALoCoQkzdbMLM+cHwyRGIIrAI+cn6QNWmqNWXNytmQFY9tFTxzSc/uLr79eiTnu8ICz4XBGYZuXa X-Received: by 10.55.16.157 with SMTP id 29mr40045175qkq.73.1434904020835; Sun, 21 Jun 2015 09:27:00 -0700 (PDT) Received: from [192.168.100.133] (rrcs-24-136-125-201.nyc.biz.rr.com. [24.136.125.201]) by mx.google.com with ESMTPSA id 41sm9047888qgf.47.2015.06.21.09.26.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jun 2015 09:26:58 -0700 (PDT) Message-ID: <5586E5D1.4010901@lerdorf.com> Date: Sun, 21 Jun 2015 12:26:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: PHP internals Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CAouxuRXj66h499fXFeNAj0MTcJdhlqXd" Subject: hasType() for internal function parameters? From: rasmus@lerdorf.com (Rasmus Lerdorf) --CAouxuRXj66h499fXFeNAj0MTcJdhlqXd Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Is it deliberate that we are not providing the parameter types for internal functions via reflection? It seems inconsistent: getParameters()[0]; $param_strlen =3D (new ReflectionFunction('strlen'))->getParameters()= [0]; echo "$param_ustrlen (".$param_ustrlen->hasType().")\n"; echo "$param_strlen (".$param_strlen->hasType().")\n"; try { ustrlen(1); } catch (TypeError $e) { echo $e->getMessage()."\n"; } try { strlen(1); } catch (TypeError $e) { echo $e->getMessage()."\n"; } The output is: Parameter #0 [ string $str ] (1) Parameter #0 [ $str ] () Argument 1 passed to ustrlen() must be of the type string, integer given, called in /home/rasmus/prop.php on line 11 strlen() expects parameter 1 to be string, integer given That is, in both cases a TypeError exception is raised because the type of the parameter is incorrect. But hasType() on the internal function parameter claims there is no type even though there obviously is one. -Rasmus --CAouxuRXj66h499fXFeNAj0MTcJdhlqXd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlWG5dIACgkQlxayKTuqOuBsCACfUWIwdHaOj8MRSO6+2OWLDWfs opUAn2Nv9fNA5MgUsT0YI4broisPhaGq =0brr -----END PGP SIGNATURE----- --CAouxuRXj66h499fXFeNAj0MTcJdhlqXd--