Re: type hinting

From: Date: Sun, 06 Jan 2008 22:07:42 +0000
Subject: Re: type hinting
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-34556@lists.php.net to get a copy of this message
On Jan 6, 2008 10:48 PM, Marcus Boerger <helly@php.net> wrote: > Hello Pierre, > > I agree something that is not really a number should not be converted into > a number as it is not compatible but then...what do we do right now? > > [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod(12,5));' > make: `sapi/cli/php' is up to date. > float(2) > [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod("12","5"));' > make: `sapi/cli/php' is up to date. > float(2) > [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod("12","5a"));' > make: `sapi/cli/php' is up to date. > float(2) > [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod("12b","5a"));' > make: `sapi/cli/php' is up to date. > float(2) > > So we do allow "12b" to be used as 12 even. Oh screw us all :-) Yes, that's a bit scary. Matthew (if I remember correctly) proposed some months ago to clean the conversion routines and to document them. The cleanup is actually necessary to minimize confusions and wtf and the documentations to write tests and stick to them (I'm not a volunteer :-D -- Pierre http://blog.thepimp.net | http://www.libgd.org

« previous php.internals (#34556) next »