Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116308 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73284 invoked from network); 9 Nov 2021 00:18:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Nov 2021 00:18:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 712931804B5 for ; Mon, 8 Nov 2021 17:11:27 -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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 8 Nov 2021 17:11:23 -0800 (PST) Received: by mail-il1-f177.google.com with SMTP id i12so18965673ila.12 for ; Mon, 08 Nov 2021 17:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=cziK9wMiHEk4j6KnNZAjwrpn50lA9Pw3UzDQPoLpY68=; b=QPsd9oZXjlMVqAWNbKRTeMrsqyGPCdEfnlEeJzt95Bb3W/vKwYbYI2wpZDatkn39FA QTq9k4+F2wb6GZSyMrvHTp1T+11STDg72gqDbfh0XJ25yIDLlPzNKLw8Equ0p5Lw7f9m pbk9RNVlN760J9omAYxM6NMZvoJPpH5Qc1qxDNfrt3SV4uAeYeeN2ZAh4g48ykE4EsCy PQUYxkk56+C/0bpWjMyiYxpEnCGJFE4mPiOwpqpin4oLuq450P7Np76xXJfTQmzHxUua CgzJuU3IUMduRetICPeEKIsh+hvw/tTxhqMn/sTNUfgRgyYSr/ynd84wJsg5CwETUuu3 qlWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=cziK9wMiHEk4j6KnNZAjwrpn50lA9Pw3UzDQPoLpY68=; b=VYToiuY+ZoJZ5GGndzUs/BgBUYlvGCZCDkUEGICj5eTcMTEDmmXJe/DD0vjAmceH86 jfVnH2TguP+44Aoa1z3MaGeWGLzJ2196T6ueEbLhjz4mw1ACLs6AV43xy2yig1STv2F1 aTMmXQEIHJFNn7StGtpVyq/HY+ndnIjr0ZOvOGjRuh4qWQwBVqlhMvFXetBjzwwsuhgO ooD1/OcIdBRdj7+HPhoQWbTG2YYYNI/nh/CrWcNJVkTZnwkjz3r19e3Z0mTe6q8hdwf3 ouvYgJJoNoYkypx+MsJ2S5yl86zM9ffi8SjQu7bxZPpYfVWQjwvBgjBbQjV4rtHhPxfS J4Og== X-Gm-Message-State: AOAM530uGT6ndk+tW62L2N7KQyDD9qF+aSgolPXxm3ysZAxVUc58sM9u RhISLQvkYV8XgWrH6LDay7vAjGW2ynawL2xNAB9/jQx+uCI= X-Google-Smtp-Source: ABdhPJx/Kv79yAjjF+kvWIawzv27imtHdB8AemUSKbIGDGTeAutqnu1KTkDUHjNkLRQGixYb6anQ5RTctSvMdThdQ2U= X-Received: by 2002:a05:6e02:1608:: with SMTP id t8mr2536358ilu.25.1636420282659; Mon, 08 Nov 2021 17:11:22 -0800 (PST) MIME-Version: 1.0 Date: Mon, 8 Nov 2021 20:11:11 -0500 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000a6b63405d050c9a8" Subject: Automatic implementation of Stringable may conflict with old, untyped arginfo declarations From: jmikola@gmail.com (Jeremy Mikola) --000000000000a6b63405d050c9a8 Content-Type: text/plain; charset="UTF-8" https://github.com/php/php-src/commit/b302bfabe7fadd07b022ee30aacf7f41ab1ae0fa recently added automatic implementation of Stringable ( https://wiki.php.net/rfc/stringable) for internal classes. This introduced fatal errors for each existing __toString() in ext-mongodb: ``` Declaration of MongoDB\BSON\BinaryInterface::__toString() must be compatible with Stringable::__toString(): string in Unknown on line 0 Declaration of MongoDB\BSON\Binary::__toString() must be compatible with Stringable::__toString(): string in Unknown on line 0 ... ``` Our arginfos for these methods have historically never reported a return type, going back to when it was originally written for PHP 5.x. For example: ``` ZEND_BEGIN_ARG_INFO_EX(ai_BinaryInterface_void, 0, 0, 0) ZEND_END_ARG_INFO() static zend_function_entry php_phongo_binary_interface_me[] = { ZEND_ABSTRACT_ME(BinaryInterface, __toString, ai_BinaryInterface_void) // ... ``` I noted that _ZendTestClass (referenced in the original commit's tests) uses ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX to declare a string return type ( https://github.com/php/php-src/blob/eda9d7ac22c70f75a44bf33139acf8c812d69944/ext/zend_test/test_arginfo.h#L74 ). While that's a trivial change we can make in ext-mongodb, I wonder if this may have been an unanticipated BC break for third-party extensions. I imagine ext-mongodb is not the only extension with older arginfo declarations predating the introduction of type reporting in later PHP versions. -- jeremy mikola --000000000000a6b63405d050c9a8--