Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94524 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59215 invoked from network); 17 Jul 2016 03:50:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2016 03:50:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=michael.vostrikov@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=michael.vostrikov@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.181 as permitted sender) X-PHP-List-Original-Sender: michael.vostrikov@gmail.com X-Host-Fingerprint: 209.85.220.181 mail-qk0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:35699] helo=mail-qk0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/D2-31884-6600B875 for ; Sat, 16 Jul 2016 23:49:59 -0400 Received: by mail-qk0-f181.google.com with SMTP id s63so133006084qkb.2 for ; Sat, 16 Jul 2016 20:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JKpBzERD/3rqQYh0sZrCGcA5sAQDDtlnMexO6Ub7G+g=; b=ZY5EgDs8OBGTS8BsEg3OADoQKiHuw2f+R50+L+4qMpMrurStg6/ByF0ZluY6uY+8D9 oGLHSRjEEBOygX1hK6aKA+jjbmz/MqrhI2meESg8qDQP+lwIh97id1fVROQPtuWGJBOB 4g8QvRGusGL5f4W9GBz5DvJ0ID8Sgk1Pqt0jlgD5LWPilNFB338hpLd0kVJiP43x0leQ R3Sc2M5qW9mpCgKY+sI90cXruPpfHvHna/djcv/wI+urG78cpJOH4vpim47kMTbdclC1 UwY+w96esuIMMHcmRXn3ohWV/ACV5AWD/RPRw37FCwj5b/H+u5FUKV1F/ATVePwOiORm Qd/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JKpBzERD/3rqQYh0sZrCGcA5sAQDDtlnMexO6Ub7G+g=; b=D9OoX1PDgYJYAYmSTeiU5wqKWgsPxRv21ymEmt7a5MbHIMAy5DFjp92xd/kqlp6RtW 2iKDboQ3PgpYuH3Khr0IwdduB+ZTSJBkfLtBpgTAxF+I0sC4SLwHGg92gHwCWgVT5+t9 MesCD2GAL1AeCHqPIYNLx8JYV2j7utc/CpIPQg9BuyLDQiYxxwdecIyeLcFknkjZGsT+ LhA0+bEiA/FtHX9nJLZeVQRIuT9D7xPsxSTo1gVhRsC1oXPk0DM/Cq7GSlvMHvMuTFGa bv7wSc6IN99jHCmg+RgXgoj2EKS27xhsDDp8LJZmTcG2VCcuPiEwq3EeJLSJqwInSXNo VGQw== X-Gm-Message-State: ALyK8tIWcjh2EDnphHmg7KeYkrrb0yD7XAW5lMy5j4LPC6oQDX5uLY0YbszVsLGK0DxssCLWhinQTWpgwJWJIg== X-Received: by 10.55.24.215 with SMTP id 84mr36216935qky.51.1468727396605; Sat, 16 Jul 2016 20:49:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.189.135 with HTTP; Sat, 16 Jul 2016 20:49:56 -0700 (PDT) In-Reply-To: References: Date: Sun, 17 Jul 2016 08:49:56 +0500 Message-ID: To: Dan Ackroyd Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a113b9dc4bf2cf00537ccbe35 Subject: Re: [PHP-DEV] [RFC] New operator for context-dependent escaping From: michael.vostrikov@gmail.com (Michael Vostrikov) --001a113b9dc4bf2cf00537ccbe35 Content-Type: text/plain; charset=UTF-8 > It would be better to return the previous handler, or NULL if one > wasn't set, in the same way as set_error_handler() does, and for the same reasons. Well, maybe you are right. But I thought, this is not a use case, usually we don't need multiple handlers for certain context. I.e. we don't need to encode single quotes in HTML as ''' in one template and as ''' in another. Use case would be the following: if there is no handler for 'my_context', register this handler. If some library really need to replace existing handler of application, it can call unregisterHandler() directly. Also in Twig there is no such behavior, and applications with it work good. I tried not to invent new mechanisms of usage. > Also, shouldn't these just be functions? Why is there a class involved > when it only has static functions/state? I didn't want to add many related items to a global namespace. And with class we can use autoloading and fully replace an implementation, unlike functions. It is possible to disable extension and use own class. --001a113b9dc4bf2cf00537ccbe35--