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. I’ve made a patch which makes zend_parse_parameters and userland type hints consistently show “integer” and “float” rather than “long” and “double”: https://github.com/php/php-src/pull/955 I also wrote a GNU sed script which I used to update the tests: https://gist.github.com/TazeTSchnitzel/c0d780466def9f226318 Alongside error messages, there are some other places that could be changed. Obviously the return value of gettype() shouldn’t be changed, but I think that we should, for example, make is_long() an alias of is_int() and not the other way around. Thoughts? -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php