Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20011 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35523 invoked by uid 1010); 15 Nov 2005 17:15:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35508 invoked from network); 15 Nov 2005 17:15:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Nov 2005 17:15:34 -0000 X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.4/2.6 Received: from ([204.11.219.139:52870] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id CA/82-07637-5B71A734 for ; Tue, 15 Nov 2005 12:15:34 -0500 Received: from [207.126.233.18] (rasmus2.corp.yahoo.com [207.126.233.18]) (authenticated bits=0) by colo.lerdorf.com (8.13.5/8.13.5/Debian-3) with ESMTP id jAFHFOH5000513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 15 Nov 2005 09:15:25 -0800 Message-ID: <437A17AB.7020705@lerdorf.com> Date: Tue, 15 Nov 2005 09:15:23 -0800 User-Agent: Thunderbird 1.5 (Macintosh/20051025) MIME-Version: 1.0 To: Jani Taskinen CC: Sean Coates , internals References: <437A0D24.6030701@caedmon.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] date() behaviour changed in 5.1? From: rasmus@lerdorf.com (Rasmus Lerdorf) Jani Taskinen wrote: > > If you pass bad data to a function, it should not warn you? > I'd rather have it as a FATAL error. :) > > Nothing to fix here, move along. (and fix your code..) The issue here is we effectively have two different casting mechanisms. One of the things we need to do when moving to PHP 6 is to make sure everything is using zend_parse_parameters() to handle function parameters. Most people would assume that a function that wasn't using zend_parse_parameters() before and was defined to take a long and thus passed the parameter through convert_to_long() wouldn't change its behaviour when moved to zend_parse_parameters() with an "l". That is: zval **foo; long lfoo; zend_get_parameters_ex(1, &foo) convert_to_long_ex(foo); lfoo = Z_LVAL_PP(foo); is not equivalent to: long foo; zend_parse_parameters(1, "l", &foo); In order to not change the behaviour of the function moving to zend_parse_parameters() from zend_get_parameters() you have to use a "z" and do the convert_to_long yourself. The reason for this is that is_numeric_string() has a flag called allow_errors which specifies whether or not it should be strict. When you cast from PHP or use one of the conversion functions internally this flag is off. When calling zend_parse_parameters it is on. I am not sure what the right answer here is. I can see the argument for being strict on parameter types, but at the same time, we will potentially be breaking a lot of existing code. And at a higher level I don't like the concept of having two different casting modes. -Rasmus