Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69668 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19485 invoked from network); 18 Oct 2013 10:58:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2013 10:58:00 -0000 Authentication-Results: pb1.pair.com header.from=cryptocompress@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cryptocompress@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.83.49 as permitted sender) X-PHP-List-Original-Sender: cryptocompress@googlemail.com X-Host-Fingerprint: 74.125.83.49 mail-ee0-f49.google.com Received: from [74.125.83.49] ([74.125.83.49:60526] helo=mail-ee0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/32-06505-63411625 for ; Fri, 18 Oct 2013 06:57:59 -0400 Received: by mail-ee0-f49.google.com with SMTP id d41so1850657eek.8 for ; Fri, 18 Oct 2013 03:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=IBU3Lq460OVgdtUsf64oPDw+uTGcVEJyq5JRq0596Qw=; b=ta38T5LUMIVXj7qwZCgHqr7fWwQrLWpUewA1ExDDKurzNaAZEJGsdE1dq540IuYmpT qKzPG8GsLYoermAqv6yb+QaSAJLBz8xBbokCz/1dUl6qhiZcwLnRuDHlC6VmOfN8MKrv i3NUjS4AktJWQv2NwqDHUuVG0JHbKsgc0E8orB/oANXdyhy181MwB7RKxncbKSuSRA4y XyonDQ3/Q5Cr4dL64RV3im98sZPRQE7poFw3loAi29JqLbmQQQj0Qj6xG832Op1C2FdD TRDZKxMUPIt1offxgNBPzRXPvLvS2J9vwMufF0bbUOePNBQen1EcQopYcKtcVWPITeR3 cE8Q== X-Received: by 10.14.103.69 with SMTP id e45mr3508365eeg.51.1382093876302; Fri, 18 Oct 2013 03:57:56 -0700 (PDT) Received: from [192.168.1.115] (mnch-5d872902.pool.mediaWays.net. [93.135.41.2]) by mx.google.com with ESMTPSA id l49sm2891591eeo.12.2013.10.18.03.57.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 03:57:53 -0700 (PDT) Message-ID: <52611431.7070407@googlemail.com> Date: Fri, 18 Oct 2013 12:57:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 CC: internals@lists.php.net References: <525C631E.1050008@gmail.com> <52610FFE.7020806@googlemail.com> <327CCB6F-3D5B-410E-84BB-547467E688B1@gmail.com> In-Reply-To: <327CCB6F-3D5B-410E-84BB-547467E688B1@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal to deprecate create_function() From: cryptocompress@googlemail.com (Crypto Compress) Am 18.10.2013 12:51, schrieb Alexey Zakhlestin: > On 18.10.2013, at 14:39, Crypto Compress wrote: > >> Am 18.10.2013 11:26, schrieb Nikita Popov: >>> You can even replicate the exact >>> behavior (minus the hiding from get_defined_functions) with just four lines >>> of code (though I have no idea what you could possibly need this for): >>> >>> function create_function($params, $code) { >>> static $i = 0; >>> $name = "create_function_" . $i++; >>> eval("function $name($params) { $code }"); >>> return $name; >>> } >>> >>> I tried to look on Github what people currently use create_function for, >>> but with little success. Nearly all results I get are uses in the php >>> testsuite (copied over to various projects). The only other use case I saw >>> was in conjunction with the WordPress add_action() function. In this case >>> the create_function call could always be replaced directly with an >>> anonymous function (i.e. it didn't need any magic create_function >>> capabilities). >> shure all things can be replaced with more and verbose code. What is the benefit of writing all this lines in contrast to one method call? >> https://github.com/phpcr/phpcr-utils/blob/master/src/PHPCR/Util/Console/Helper/PhpcrCliHelper.php#L111 >> >> -1 for removing wrappers/abbreviations/and such >> +1 for bug fixing > > I think you misunderstood Nikita's proposal. > "all these lines" can be put in a library and your code would just continue to work the way it is. > > Idea is that it is trivially implemented in userland and there is no much sense to keep it in core. It is possible to write most of the array functions in plain php with a trivial foreach. Can't see the point.