2014-12-14 19:35 GMT+01:00 Andrea Faulds <a...@ajf.me>:
> Good evening,
>
> Unfortunately, zend_parse_parameters and userland type hint error messages 
> use outdated type names, and don’t even do so consistently. For example:
>
> $ php -r 'fread(0, 0);'
> PHP Warning:  fread() expects parameter 1 to be resource, integer given in 
> Command line code on line 1
>
> $ php -r 'fread(fopen("data:text/plain,test", "r"), 
> fopen("data:text/plain,test", "r"));'
> PHP Warning:  fread() expects parameter 2 to be long, resource given in 
> Command line code on line 1
>
> $ php -r 'function foo(foobar $x) {} foo(1.0);'
> PHP Catchable fatal error:  Argument 1 passed to foo() must be an instance of 
> foobar, double given, called in Command line code on line 1 and defined in 
> Command line code on line 1
>
> Specifically, zend_parse_parameters will always “expect” a “long”, yet when 
> the expected type isn’t an integer and an integer is passed, it says “integer 
> given”. Alongside this, both userland type hint errors and 
> zend_parse_parameters errors refer to “double” and not “float”.
>
> I want to change the type names to be consistent, because I think our current 
> inconsistency is confusing. Integers are sometimes ints or integers, but 
> other times longs. Floats are sometimes floats, but other times doubles. If 
> scalar type hints are ever added, then jettisoning the old aliases means we 
> don’t have to add extra reserved words.
>

You forgot that they can also be 'real', but on a serious manner, I
don't see any reason not to make the error messages consistent and I
would say go ahead already.



-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to