Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112902 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36106 invoked from network); 15 Jan 2021 17:32:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jan 2021 17:32:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BD47B1804D1 for ; Fri, 15 Jan 2021 09:11:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from web138.dnchosting.com (web138.dnchosting.com [104.171.28.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 15 Jan 2021 09:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=colannino.dev; s=default; h=Content-Type:MIME-Version:Date:Message-ID: Subject:From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=paXO4+OYm3VaMs2LUvJANVsZhNGTxFm+NfHtR3R7j8A=; b=CdGvNDe/x04+m+F34lNK2dJms0 22clDpmEsvhdGpcDkcc0pECTnS48evsgfyo1BOFd2n2vi5wshicsh7/P6rcytl/jE7V7lJ5s7eAYs 7e0kuGk0PMmo/JISUJ5FLQksjpeUTnqLww8PBzLpU/CRivopMDldhtQrnRTvbQUuWabT405PJlesu l9apv/C0zlJu48tK/EHYObrO3NtAlyy2FJffd4q1M2efsYBk7J+EdLMFRnBedNhrCt7yNl9G9qSoQ Ujgagk60ATx+svoNZEpKDx4mCoZ2jVxi0RRIlBkqXjmMfQX1Ub2kEUpVZQw2t5dD6uUbtyhLwRA51 3PMLmSZg==; Received: from cpe-23-243-43-243.socal.res.rr.com ([23.243.43.243]:53392 helo=[192.168.0.12]) by web138.dnchosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1l0Scj-0001HR-4x for internals@lists.php.net; Fri, 15 Jan 2021 17:11:02 +0000 To: internals@lists.php.net Message-ID: <90e4acaa-899d-9a20-1653-f58a2a04aeb6@colannino.dev> Date: Fri, 15 Jan 2021 09:10:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------C3E440E0A0E64428A4F933C8" Content-Language: en-US X-OutGoing-Spam-Status: No, score=-0.5 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - web138.dnchosting.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - colannino.dev X-Get-Message-Sender-Via: web138.dnchosting.com: authenticated_id: james@colannino.dev X-Authenticated-Sender: web138.dnchosting.com: james@colannino.dev X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, there is a forwarder that points to the actual sender. Subject: Arg info / zpp mismatch on PHP 8.0 From: composer@colannino.dev (James Colannino) --------------C3E440E0A0E64428A4F933C8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I have the following method defined in a PHP 8 extension: ZEND_BEGIN_ARG_INFO(arginfoCtor, 0)     ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)     ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 1) ZEND_END_ARG_INFO() PHP_METHOD(Trogdord, __construct) {     trogdordObject *objWrapper = ZOBJ_TO_TROGDORD(Z_OBJ_P(getThis()));     char *hostname;     size_t hostnameLength;     long port = TROGDORD_DEFAULT_PORT;     zend_parse_parameters_throw(         ZEND_NUM_ARGS(),         "s|l",         &hostname,         &hostnameLength,         &port     );     ... } This works fine on PHP 7, but on PHP 8, I get an "Arg info / zpp mismatch" error. I discovered that if I comment out "ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 1)", it works, but I'd like to type hint that second optional argument if possible. Maybe I was always doing this the wrong way, but I thought that the last argument 1 to allow null was the proper way to handle this and I'm not sure why it results in an error now. Can anyone tell me the correct way to approach this in PHP 8? Thank you! --------------C3E440E0A0E64428A4F933C8--