Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67720 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62400 invoked from network); 18 Jun 2013 15:28:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2013 15:28:45 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.181 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.181 mail-ob0-f181.google.com Received: from [209.85.214.181] ([209.85.214.181:62125] helo=mail-ob0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/B4-24847-BAC70C15 for ; Tue, 18 Jun 2013 11:28:44 -0400 Received: by mail-ob0-f181.google.com with SMTP id 16so4655409obc.40 for ; Tue, 18 Jun 2013 08:28:41 -0700 (PDT) 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=lVHWtOLKuu3HgWu0asAISVq07ZytFNrE4YP+smszFMc=; b=WL31/walNn7yNrDFZML1EgLmVYQDmkMTZhk6v+dezzRUWexi/KdCYHCYwfw3qEGA6T QRVXmZfERjxajf6NxI7E+qdRiT9FPsDA52HybFSyb3LtoVZqM+AG490cOjyaR+uNNUoT rqH7/GBvweUUj6aq8HE+1zqaAyQyFRXKBfmunq9wd+6bDO5+Uqu5c+pSt0ncjZFUBFDp x8mLGnQVFpdq2HOEVHGNhqdGLWB4ca8OiGcovxflp17PMBJx4ZuFEV84H+Gz5UuA1WYz 9IrBt30rvZDuDI6277+WpZIi8zdRpRtaocnCSFLQWaKnGW2t91MeU049jbGAsUGmSjA8 EjLQ== MIME-Version: 1.0 X-Received: by 10.60.17.104 with SMTP id n8mr12195678oed.75.1371569321216; Tue, 18 Jun 2013 08:28:41 -0700 (PDT) Received: by 10.76.9.226 with HTTP; Tue, 18 Jun 2013 08:28:41 -0700 (PDT) In-Reply-To: References: Date: Tue, 18 Jun 2013 09:28:41 -0600 Message-ID: To: Sherif Ramadan Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e013c68202d163c04df6f5e6c Subject: Re: [PHP-DEV] PR 287 - added use_keys argument to array_filter() [Discussion] From: morrison.levi@gmail.com (Levi Morrison) --089e013c68202d163c04df6f5e6c Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jun 18, 2013 at 9:07 AM, Sherif Ramadan wrote: > > On Tue, Jun 18, 2013 at 10:58 AM, Levi Morrison wrote: > >> >> I'm starting up a thread for discussion on Pull Request 287 >>> https://github.com/php/php-src/pull/287 (allowing array keys to be >>> passed >>> to the callback function of array_filter through a third optional boolean >>> argument). I would like to merge this into master and as discussed on IRC >>> it would probably be a good idea to startup a discussion and make sure >>> there aren't any objections or clarifications not yet voiced. >>> >>> The patch has no BC because the third argument is optional and defaults >>> to >>> false. Personally, I have always thought it would be a good idea to be >>> able >>> to get the keys into the array_filter callback since I've stumbled >>> across a >>> few scenarios where that would have made things easier. >>> >>> I'm not sure if there are any particular down sides to this option being >>> added, but none that I can find. It currently passes all tests in master >>> and works as expected. >>> >>> Thoughts, opinions, objections, concerns? >>> >>> >> It might be considered a BC break, but I really think we should drop the >> boolean argument; just have it pass the key as parameter 2 always. >> > > > See the discussion on github for that PR > https://github.com/php/php-src/pull/287#issuecomment-14175109 unfortunately > we can't do that as it will break lots of userspace code that might be > doing stuff like array_filter(['foo','','bar'], 'strlen') where strlen only > accepts a single argument and in those cases the result will be triggering > lots of warnings and failed code. > If `strlen` can't handle extra parameters then I'd say *that* is a real problem, this PR aside. --089e013c68202d163c04df6f5e6c--