Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113202 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53872 invoked from network); 18 Feb 2021 02:28:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Feb 2021 02:28:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B7EE1804B1 for ; Wed, 17 Feb 2021 18:15:30 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (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 ; Wed, 17 Feb 2021 18:15:29 -0800 (PST) Received: by mail-oo1-f41.google.com with SMTP id x23so112096oop.1 for ; Wed, 17 Feb 2021 18:15:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CuajTlCElEkT25Cf1Dn4KO4FvSxj0vuuThXNZU3Yo3k=; b=OuNu60CfVRSzlDP1TRhVd9GoybY623pe/Z9rNamfWJpVtVS8Qh48fhtEoClciZDVcm fwmwa0DPlCt14QSEcvgebYrRRe1GwKszKGcsJnWVseGqt3jJ2OM2noYeZQrS82j1r4Ly Gek+BzuuyBVwPOLR+Rag2QQtTxRIu1mxtEjXLGXhhdop9bkaaPtC8yFyuIZwbufehbJ8 cqPa0tjnuLi6id7LZmGGtw5ZJzSz9YKU62SbYX3+GdQjtIGX+cga5Iezt6l7VaZ+tTIB kfyIqeNY1jki/Zi3D4L/UgycVpqQZmk8vEl+ux2fZAYV+ZXtGhQxkGxLEpEmcUVWn9gs SDfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CuajTlCElEkT25Cf1Dn4KO4FvSxj0vuuThXNZU3Yo3k=; b=fyodQlh3bWoC64engZ995bDkPdOz3AUUt59U92N6pu8LJMsrU+LbY5kIrqvuRngXwe zeQdF3VB0AE8cG6TSCvHvee/6IuZA8GK5X0SdOBZsAybGBTPbPE+mEpmmUEwFG8zb4wE AtI2jIo1bPf7Jb3kNTD2Ux310OsWpuHsJSKePmRE0EEV3/wV3E5tRkfg5IayVcOuvut7 1l5jY136RFSUiISdAN2bNH8U6l1CoNfKRQOcEbFfwINzowQRwnv5Q3Qy7fVfChw3TTPl IicmHQ2fptFnKu5+dYIiAfyWe/OFjBD1Rqlg0M2yvyTJDEA/RyjWFoDGJ7M4NZGpMRnF cyVw== X-Gm-Message-State: AOAM53299+wa3yHTt07OcmK6UyjTBz+/wLLp9w4TIcCTNwjU0rmwz1wR gtrIzvszGv5A5IkcDweLA3+cTIqBA5QRhHASbJQ= X-Google-Smtp-Source: ABdhPJz3+wFYoJhlHFY+MdgL1nkj7MaXnrQ3eO2ktmVdb2cQpnZk62tCDRglNdvqL/KdMFraM56Y5jaGHHTkNx3HeK8= X-Received: by 2002:a4a:d856:: with SMTP id g22mr1439419oov.18.1613614525325; Wed, 17 Feb 2021 18:15:25 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 17 Feb 2021 23:15:13 -0300 Message-ID: To: Nikita Popov Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000096255305bb92e8d0" Subject: Re: [PHP-DEV] preg_replace(string, null) is allowed? From: david.proweb@gmail.com (David Rodrigues) --00000000000096255305bb92e8d0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks! There is a reason why it is not supported anymore? There is a difference in output or performance, maybe? Atenciosamente, David Rodrigues Em qua., 17 de fev. de 2021 =C3=A0s 17:37, Nikita Popov escreveu: > On Wed, Feb 17, 2021 at 9:28 PM David Rodrigues > wrote: > >> Hello! >> >> I am in doubt if passing null as the second argument to preg_replace() i= s >> valid. Actually, it works as expected. >> >> https://3v4l.org/0TITS >> >> But doc only accepts array|string. >> >> I am asking for it because PhpStorm will not accept it. So if it is vali= d, >> I will do a PR to PS stubs. >> > > On PHP 8.1.0-dev your example prints: > > Deprecated: preg_replace(): Passing null to parameter #2 > ($replacement) of type array|string is deprecated in %s on line 3 > > Under strict_types=3D1 it already throws. > > So no, it is not valid. > > Regards, > Nikita > > --00000000000096255305bb92e8d0--