Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80203 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76253 invoked from network); 5 Jan 2015 22:10:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2015 22:10:32 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.172 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 74.125.82.172 mail-we0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:64125] helo=mail-we0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/8A-21693-6DB0BA45 for ; Mon, 05 Jan 2015 17:10:32 -0500 Received: by mail-we0-f172.google.com with SMTP id k11so8724626wes.31 for ; Mon, 05 Jan 2015 14:10:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kjnTenoV++pr+x9FbuZvRKdn4wMtAxDY8iu8mEmL7RI=; b=vAFW0ETqXFD5dk5exTQPezuZVF5j+vu5J3PBkW//tSZf+ek5wte1KlawVjWtB57VLd P0j+zOHv03SD7RbiZYKffsOdU3IRV7KDetbSS1JaOg1m/3zL6LRnbjwxf1ZcBWHASs6C oetfrCgNETWjsijxi1lNusKUDzy3kQHIJ3/SUA5sRF/ulU4W+MADlCNY7REyQb2gTTxG YbRqhIbWVvRIQy/rTed2AcAyQlfQ/KyDeZqDCk3qPxhg2mXbiPreC0ymMTVPeVeoQFWy cnhokxT2NfQZV7zKKqbnh/9a14oihPUOXFoZ0XmhlvJYGxBDjgtKnV+iZMYPXssX/Ig7 4kaA== MIME-Version: 1.0 X-Received: by 10.194.90.10 with SMTP id bs10mr186787959wjb.43.1420495825463; Mon, 05 Jan 2015 14:10:25 -0800 (PST) Received: by 10.180.88.33 with HTTP; Mon, 5 Jan 2015 14:10:25 -0800 (PST) In-Reply-To: <14C3C30A-3B71-4DB7-B406-91429A7B05B6@ajf.me> References: <003e01d0290b$2387dd30$6a979790$@yahoo.fr> <54AAF3DE.2050508@gmail.com> <14C3C30A-3B71-4DB7-B406-91429A7B05B6@ajf.me> Date: Mon, 5 Jan 2015 23:10:25 +0100 Message-ID: To: Andrea Faulds Cc: Stanislav Malyshev , nf.laupretre@yahoo.fr, PHP Internals Content-Type: multipart/alternative; boundary=047d7bd9058e14f1c7050beef57c Subject: Re: [PHP-DEV] [BugFest] Feature request #38685: str_[i]replace(): Add support for (string needle, array replace) From: tyra3l@gmail.com (Ferenc Kovacs) --047d7bd9058e14f1c7050beef57c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Jan 5, 2015 at 9:30 PM, Andrea Faulds wrote: > > > On 5 Jan 2015, at 20:28, Stanislav Malyshev wrote= : > > > > Hi! > > > >> usually each BC break would warrant an RFC and a vote, but I'm not sur= e > >> many people would use str_replace("foo", array("bar"), $subject); and > >> expect the implicit array to string conversion of array("bar") =3D> > "Array" > >> which also emits a notice. > >> let's see what others think. > > > > I wouldn't consider this a BC break. Anybody who relies on implicit > > array->string conversion has a bug anyway, and we allow that implicit > > conversion to survive only for legacy reasons, but I don't think it > > should drag behind itself the promise we'd never support array paramete= r > > where there was only string before. In summary, I'd say no BC break her= e. > > To add to what Stas says: ZPP doesn=E2=80=99t allow array->string anyway,= this is > just a quirk in str_replace=E2=80=99s handling of its =E2=80=98z=E2=80=99= parameter. So users > wouldn=E2=80=99t expect it to work anyway, right? > users don't know much about how zend parameter parsing works in general, and both $search and $replace is documented as mixed plus the only reference about this usage in the documentation is the "The converse would not make sense, though. " sentence which can be easy to miss. So while I agree that the current working doesn't make much sense, I don't think that it is that obvious that this shouldn't behave as it does atm. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --047d7bd9058e14f1c7050beef57c--