Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33483 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11856 invoked by uid 1010); 28 Nov 2007 10:47:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11841 invoked from network); 28 Nov 2007 10:47:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2007 10:47:29 -0000 X-Host-Fingerprint: 84.58.186.67 dslb-084-058-186-067.pools.arcor-ip.net Received: from [84.58.186.67] ([84.58.186.67:11589] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/93-08781-F374D474 for ; Wed, 28 Nov 2007 05:47:29 -0500 Message-ID: <46.93.08781.F374D474@pb1.pair.com> To: internals@lists.php.net Date: Wed, 28 Nov 2007 11:47:29 +0100 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 84.58.186.67 Subject: question regarding type hinting parameters of php functions (array_slice) From: dirk.thomas@4wdmedia.de (Dirk Thomas / 4wd media) Hi, i have tried a current snapshot of PHP 5.3 and have a question regarding type hinting. For example when using the function "array_slice(array $array, int $offset, int $length)" with a non-integer length parameter, what is the desired behavior? When calling "array_slice($array, 0, (float)2);" the resulting array is EMPTY. When using the right type "array_slice($array, 0, (int)2);" it works as expected. Shouldn't there be a notice/warning than just a wrong return value? In my case there is neither a warning nor does it work as expected. (perhaps i do something wrong?) Of course i can use int's, but in my opinion either a warning should be given or the function should gracefully handle the wrong typed parameter. Is this problem specific to "array_splice" or the same with other functions? It works with 5.2.x without a problem. Thank you for any feedback, Dirk PS: i posted this to php-general before and someone supposed to better post it to the iternals list