Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101827 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88867 invoked from network); 11 Feb 2018 23:03:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2018 23:03:48 -0000 Authentication-Results: pb1.pair.com header.from=pslacerda@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pslacerda@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.53 as permitted sender) X-PHP-List-Original-Sender: pslacerda@gmail.com X-Host-Fingerprint: 209.85.218.53 mail-oi0-f53.google.com Received: from [209.85.218.53] ([209.85.218.53:40331] helo=mail-oi0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/B6-18020-3DBC08A5 for ; Sun, 11 Feb 2018 18:03:47 -0500 Received: by mail-oi0-f53.google.com with SMTP id 8so9842533oix.7 for ; Sun, 11 Feb 2018 15:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=2MALVJjhW+hhzsM92iXomnOHmZz5r2U0lxc7KuT4PMY=; b=a3KwqpQQhaPo6uvxzg7c0j9YxUKVHQ+4/9Am7L3V5pXfVn+KIUOM1aRwBAZP7fbO3D qpDhay8FC4nK2Kep3JoXTyBwWMAy2dOhPgYuUER409jjDngpPlUugyOl6I1JV9PTZJZU Pqh5lvRMUC+e50zvPEpDbYs31II8te8WNvC1uh3pfcM0GoHd40ox0KdLNZEA1fiD2mWT 0xnZoQ9+BoS3nR2seq23b/khqFUNFwVG5TU0RVtjTJ4S4afLDTM0dJGlDaztnHM6Oeuk qLc6o6TsfeLq25sPLsACAhdhQAule5BMat/enh0M8GyG1eHsZcO3VQU96Eg4ciiUfJ9x wNXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2MALVJjhW+hhzsM92iXomnOHmZz5r2U0lxc7KuT4PMY=; b=j9s++crdt2S34JWcYLjp8UjF7s/9o2oXRseXiVlpURl1AqdtwRsQJMJ9kAIuci3pzi 0uWNZSpnND8F2H3KNfmC0T5DfLWCw+z+nuE5M+JKQp+aEwKYu3YrISgrdx8H5Q6/cyLl 0BFe0JmRF3WcIa4lYV/T0nG5mWdZB3wzBtBJwm7Xng/IB1XM1dM/OuUIafkaBogs6FBW vqlevnTr/iC9p7UQpjRitgkxz7NUw3cUAoRBWV5FBFM08tBp0Q1+wrFLnXcQHCRKmL2y yz8CvW9f+RjkXCGR0zjC3xWtb1nDKc+/efH6zBLBR5ILV8pHx5dSpeDvJwVpRVq2QnWI WZbg== X-Gm-Message-State: APf1xPALMBQizqvKkVhTR0ksP37b72on5yX4AH5QejdodX+zUvcbV3MV hk/7UXQN+xbFBbIBcwb1Nt4KiAn2S6lraX9CWkS1aXGn X-Google-Smtp-Source: AH8x2263122tVhArc9is+ZtLRv5ppFjIk3ne0nBXNZN9+kgyDe737h0gN7z6/aPw5hPusTbUqrqNg4xlr5/0m/TnG1g= X-Received: by 10.202.51.139 with SMTP id z133mr6464363oiz.337.1518390224583; Sun, 11 Feb 2018 15:03:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.7.195 with HTTP; Sun, 11 Feb 2018 15:03:24 -0800 (PST) Date: Sun, 11 Feb 2018 20:03:24 -0300 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="001a113cd3def7831a0564f7c5a4" Subject: Proposal to run all tests with and without strict_types enabled From: pslacerda@gmail.com (Pedro Lacerda) --001a113cd3def7831a0564f7c5a4 Content-Type: text/plain; charset="UTF-8" Hi PHP developers, I'm new to the PHP development world and enjoying to learn the internals of this popular language. I'm also very interested in testing and typing. Most if not all of the few tests in ext/ with strict_types=1 are related to bugs. Function argument parsing is done explicitly (eg with Z_PARAM_OPTIONAL or Z_PARAM_LONG) and this is prone to errors. * sodium/tests/sodium_error_001.phpt * date/tests/timezones-list-strict.phpt * mysqli/tests/bug74547.phpt * zlib/tests/zlib_wrapper_level.phpt * gettext/tests/bug73730.phpt Currently all other tests are done with strict_types=0, so coverage can be increased simply by enabling strict_types. On a pull request discussion, Nikic said that enable it would fail for many tests of invalid inputs so the signal/noise ratio would be too low. Than I modified run-tests.php to accept a -t flag that inserts "declare(strict_types=1);" in the --FILE-- section of .phpt tests. Really happened what he said, tests for invalid input failed. So a new function check_strict_types() was needed to expose ZEND_ARG_USES_STRICT_TYPES() enabling .phpt tests to check for it in the --SKIPIF-- section if needed. I suppose that a function check_strict_types() didn't existed before because had no valid use cases and maybe also avoid the user to trick the interpreter. But seems really useful to run all possible tests with strict_types=1. You can start checking the implementation correctness with: $ ./run-tests.php -t ext/date/tests/timezone_transitions_get_variation3.phpt And the implementation draft is at this repository: https://github.com/php/php-src/compare/master...pslacerda:experimental/strict_testing?diff=split My proposal is to run all tests with and without strict_types, skipping if necessary, and increasing the code coverage. Depending of you overral reception I'll create an RFC for it. PHP for president! -- Atenciosamente, Pedro Lacerda --001a113cd3def7831a0564f7c5a4--