Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83883 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73978 invoked from network); 26 Feb 2015 10:34:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2015 10:34:18 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 74.125.82.49 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 74.125.82.49 mail-wg0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:43715] helo=mail-wg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/A1-65287-9A6FEE45 for ; Thu, 26 Feb 2015 05:34:18 -0500 Received: by wggy19 with SMTP id y19so9255694wgg.10 for ; Thu, 26 Feb 2015 02:34:13 -0800 (PST) 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:date :message-id:subject:from:to:cc:content-type; bh=/w4YjxGu5NXYIhOzXSLtAvLXbrMwcDVJ3zq0KQBBqKE=; b=jrVLU2hNWKOlPGq9h+wZxnIvRl7FLfUekiFm2dcEHmFIYIoQ4U/sNrUg4Yvgu9zJc1 l8HuApn34FeVfJrpCfE9eVMaMUCoHYi/+5JfKxeDy0w11OVmsStIE5g/xpp+QojYMRCt madR54/0zC/e+4Wck2nRqO703zT5ZeCZtrQIiSc08bWRjtY/MA5nOZliz2HMZSn4UIC1 QTJutZqqqNWl31HMbGA/V4fbuUdhSKn/gXpNQGaQnsqQWRS17+tIRGuro49HTmCKpIas yxeJc+3H7H110MXXh7MbtEnh+/OXzQaqzavDQ3QZD7/jIW9G6HdwxzJ5VbFhHRBKZFFE AVhA== X-Gm-Message-State: ALoCoQk5t1TP+r9CRa8zRJpziCS6SG0U8BZ40QFl5t2syZ/c8qhNaCdlKyoGa2O7t6JAFw/qYWmB MIME-Version: 1.0 X-Received: by 10.194.185.9 with SMTP id ey9mr15235249wjc.135.1424946853384; Thu, 26 Feb 2015 02:34:13 -0800 (PST) Received: by 10.194.192.202 with HTTP; Thu, 26 Feb 2015 02:34:13 -0800 (PST) X-Originating-IP: [77.11.23.161] In-Reply-To: References: Date: Thu, 26 Feb 2015 11:34:13 +0100 Message-ID: To: Dmitry Stogov Cc: Anthony Ferrara , PHP Internals Content-Type: multipart/alternative; boundary=047d7bd6adce0549c8050ffb4b93 Subject: Re: [PHP-DEV] Strict typing and callback vs declare() From: kontakt@beberlei.de (Benjamin Eberlei) --047d7bd6adce0549c8050ffb4b93 Content-Type: text/plain; charset=UTF-8 On Thu, Feb 26, 2015 at 11:10 AM, Dmitry Stogov wrote: > Hi Anthony, > > What do you think about using a user level callback for strict type checks > instead of declare(). It won't allow changing behavior per file, but this > has its own cons and pros. > > set_strict_type_checker(function ($class_name, $function_nume, $arg_num, > $expected_type, $value, $file, $line) { > ... > return false; > }); > include("orig_index.php"); > ?> > > If callback is not set, arguments are converted according to standard > rules, if set and returns false - fatal error or exception is thrown. > > The implementation should be simpler and more efficient than using > declare(). > > Thanks. Dmitry. > This ruins portability with third party libraries completely. --047d7bd6adce0549c8050ffb4b93--