Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Alain Williams
On Sat, Jan 05, 2008 at 07:34:04PM -0800, Mike Lively wrote: input is going to makes it's way into your api at some point. Now of course you can (and should) be filtering this input before it is used, but if imo when dealing with a loosely typed language where the same input could be

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Kore Nordmann
Am Sonntag, den 06.01.2008, 11:28 + schrieb Alain Williams: On Sat, Jan 05, 2008 at 07:34:04PM -0800, Mike Lively wrote: input is going to makes it's way into your api at some point. Now of course you can (and should) be filtering this input before it is used, but if imo when

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Alain Williams
On Sun, Jan 06, 2008 at 12:51:20PM +0100, Kore Nordmann wrote: Am Sonntag, den 06.01.2008, 11:28 + schrieb Alain Williams: PLEASE READ CAREFULLY You have NOT understood what type hinting is about. You are confusing the TYPE and the VALUE. What type hinting means is: *

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Stefan Esser
Hello Alain, I think you are also confused about PHP type hinting... The manual clearly states: Type Hinting PHP 5 introduces Type Hinting. Functions are now able to force parameters to be objects (by specifying the name of the class in the function prototype) or arrays (since PHP 5.1).

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Alain Williams
On Sun, Jan 06, 2008 at 01:02:54PM +0100, Stefan Esser wrote: Hello Alain, I think you are also confused about PHP type hinting... The manual clearly states: Type Hinting PHP 5 introduces Type Hinting. Functions are now able to force parameters to be objects (by specifying

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Sven Drieling
Am Sonntag, 6. Januar 2008 12:28 schrieb Alain Williams: Hello, You are confusing the TYPE and the VALUE. What type hinting means is: * is the TYPE correct ? If so succeed. * can the VALUE be 100% converted to the desired TYPE (eg '5' to int) ? If so succeed. * fail ?php echo (int) 1,

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Magnus Määttä
On Sunday 06 January 2008, Alain Williams wrote: On Sun, Jan 06, 2008 at 01:02:54PM +0100, Stefan Esser wrote: Hello Alain, I think you are also confused about PHP type hinting... The manual clearly states: Type Hinting PHP 5 introduces Type Hinting. Functions are

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Sam Barrow
On Sun, 2008-01-06 at 11:28 +, Alain Williams wrote: On Sat, Jan 05, 2008 at 07:34:04PM -0800, Mike Lively wrote: input is going to makes it's way into your api at some point. Now of course you can (and should) be filtering this input before it is used, but if imo when dealing with

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Sam Barrow
On Sun, 2008-01-06 at 15:59 +0100, Magnus Määttä wrote: On Sunday 06 January 2008, Alain Williams wrote: On Sun, Jan 06, 2008 at 01:02:54PM +0100, Stefan Esser wrote: Hello Alain, I think you are also confused about PHP type hinting... The manual clearly states:

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Mike Lively
On Sun, 2008-01-06 at 10:55 -0500, Sam Barrow wrote: function requireFile(string $file, bool $getOutput = false, array $args // ... This function will not be called using input data. So is there some way you are ensuring that users of your code NEVER pass a value that trickled down from a

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Giedrius D
On Jan 6, 2008 5:55 PM, Sam Barrow [EMAIL PROTECTED] wrote: As I said, this patch is not intended for stuff like $_GET, $_POST, database data, etc. It is intended for internal functions to your application. function requireFile(string $file, bool $getOutput = false, array $args = array())

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Mikko Koppanen
Why I mean by: Type HINTING is not type ENFORCEMENT. is that: function foo(int $a) {} foo(1); // OK foo(1); // OK - the string is juggled to an int when the function is called // ENFORCEMENT would have (in some

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Markus Fischer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mikko Koppanen wrote: | I have not been following very closely this conversation so this might have | been answered already: | | | $b = '5'; | | function foo( int $a ) | { | echo gettype( $a ); | } | | foo( $b ); | | echo gettype( $b ); | | | what

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Sam Barrow
On Sun, 2008-01-06 at 09:03 -0800, Mike Lively wrote: On Sun, 2008-01-06 at 10:55 -0500, Sam Barrow wrote: function requireFile(string $file, bool $getOutput = false, array $args // ... This function will not be called using input data. So is there some way you are ensuring that

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Sam Barrow
On Sun, 2008-01-06 at 19:18 +0200, Giedrius D wrote: On Jan 6, 2008 5:55 PM, Sam Barrow [EMAIL PROTECTED] wrote: As I said, this patch is not intended for stuff like $_GET, $_POST, database data, etc. It is intended for internal functions to your application. function requireFile(string

Re: [PHP-DEV] Type hinting misunderstood

2008-01-06 Thread Sam Barrow
On Sun, 2008-01-06 at 20:02 +, Mikko Koppanen wrote: Why I mean by: Type HINTING is not type ENFORCEMENT. is that: function foo(int $a) {} foo(1); // OK foo(1); // OK - the string is juggled to an int when the function is called