Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123946 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 821841A009C for <internals@lists.php.net>; Thu, 27 Jun 2024 17:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719508888; bh=pcZBvgVqvr/uJZVVD8x8oOm8Ows0HKVY3E3rsPti5Fg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=OS57L2oo/9B8V2+I+y/Q+5Cy7qdDYL33xqLRsGpgQCo6+Xhm/OzWJLNxw/ZhxMuEA dqN2h98Bs+5k1+rpTAan+IfXorf+G35vBN5ulLMkTOvOyLfvfSsivsABfbOsUnf9PK fbzTLiVIJAmXoDWlw3DMZ8tP9bBax2cjHGlaCttY26REqpRaQ6LrTG1Y3RO6jyjOKE SfaMwpBFu7jm2tPOLsHFVUHTy3aOoVoQEGcsnntztkCWMfsPnbT19Uskj9M3/ROzav ltC0JDg6MYE2bABvdWWYD/UVmVoq2mRLvJoMcw8POPnJPdFwy/5B2xHRJYBOiYmAdk FqfqeG0XlOEWA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C818E180A77 for <internals@lists.php.net>; Thu, 27 Jun 2024 17:21:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: <tim@bastelstu.be> Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for <internals@lists.php.net>; Thu, 27 Jun 2024 17:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1719508807; bh=flgsIdmN9EOj6JgPOzwcliM+fD4Yol1Xndu31e8ps9I=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=KfeWkgzIBuKjVPzPBu6ircIqqbu6d7W2JrjYPlXtAHDNWFR2Z+K4CDMRPzdHKXxl6 23kRgDeGwbD41h17p+sP66RL4Iw3kJnA/XgUw/eBhI/ZwJl32xREVlGFkCPJdnP8ED qu5vkeBW0Z3BKoDWDi8DElQdO1VnwCPHjZdJ3sNIvmCtFEzIS1BbRhu+/Rqb1JG991 PnFsWgJclJzVHEpabpas72Ni1Ev9qZ1QTTNiOP3bwIc4Zyn/aRvLVBi3s8CCNAhghT mLCB4SzydSZakI12hMGAJrQCCF1VT56TS1kt1NLMMlBOefStFl3c0kP51dJiLRk+3c y2NEbW94WhYTA== Message-ID: <3f230c9b-7aca-4bce-ab2a-544a10bf128f@bastelstu.be> Date: Thu, 27 Jun 2024 19:20:06 +0200 Precedence: bulk list-help: <mailto:internals+help@lists.php.net list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net> list-post: <mailto:internals@lists.php.net> List-Id: internals.lists.php.net MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4 To: Markus Podar <markus.podar@gmail.com>, internals@lists.php.net References: <bw20I5b7ly3lSbI-2Bv3kfrfTVJbDo5RhwBiQa1PEwuLjprDJWptPajLiaialj1RLVKu7z1j0MofJUhhRVtzT_5i2E11oKeQx_VMUxnKhUE=@gpb.moe> <E146A171-CFA6-4E3F-91AA-2ACE7710A6D9@newclarity.net> <dbGe34EpQtjyP7ja7aUHnZYwmtupxeLd7EoOv3JjQMSh_UqoMrbqo5PkxrlIiaXJePC1-TfLyyblz5QDM13OkitgBqKPuSvh28WiJFh7qJI=@gpb.moe> <B958318C-B61D-4618-BA7D-3BF204C5B3CD@newclarity.net> <ca140b2c-51ff-4217-8f66-23f877ac0cb8@gmail.com> Content-Language: en-US In-Reply-To: <ca140b2c-51ff-4217-8f66-23f877ac0cb8@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 6/27/24 09:44, Markus Podar wrote: > 👎 on deprecating it; if a gotcha with it is not clear (e.g. using it in > different scopes, as this was brought up), I see this rather as a > "documentation problem". If one can easily use a function incorrectly in a way that is not *immediately* apparent, then I consider the function to be badly designed. In my book this includes all functions that rely on global state, because that will lead to spooky action from a distance sooner rather than later. Here's an example (https://3v4l.org/XNl3X): <?php function processInner($line) { $tok = strtok($line, ","); while ($tok !== false) { echo "Entry=$tok\n"; $tok = strtok(","); } } function processOuter($csv) { $line = strtok($csv, "\n"); while ($line !== false) { processInner($line); $line = strtok("\n"); } } processOuter("foo,bar,baz\na,b,c\n1,2,3"); Each of the functions individually is "fine" (for an appropriate definition of fine), but combined they are buggy. This becomes worse when the processInner() function is part of a third party library you don't control. Do you check each update of that library to see if it added or removed any strtok() calls anywhere? Pointing towards the documentation is not an excuse for bad API design. Best regards Tim Düsterhus