Re: [phpng] naming
| From: | Rowan Collins | Date: | Thu, 08 May 2014 00:13:20 +0000 |
| Subject: | Re: [phpng] naming | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74043@lists.php.net to get a copy of this message | ||
On 07/05/2014 21:21, Marc Bennewitz wrote:
On 07.05.2014 21:29, Rowan Collins wrote:Actually, further digging reveals that gettype() does actually have its own implementation (it just happened to be identical). zend_get_type_by_const is used in a handful of places, but mostly for reflecting typehints (which can't be "float" or "double" AFAIK). There were a lot of tests expecting the old wording, and a few other messages with "double" instead of "float", so I went through and changed them all. The only odd case I (or rather a PHPT test) spotted is the list of class constants when you echo a whole class (see changes to ext/reflection/tests/bug29986.phpt). The complete set of changes is on a branch here: https://github.com/IMSoP/php-src/compare/zpp-type-names If nothing else, this has been an interesting experience in getting my hands dirty with building and testing. :) [PS: Apologies for topic drifting this thread.] Regards, -- Rowan Collins [IMSoP]Andrea Faulds wrote (on 07/05/2014):gettype should be the only part where the PHP type is named "double" and this is documented as follows: ""double" (for historical reasons "double" is returned in case of a float, and not simply "float")".On 7 May 2014, at 19:11, Rowan Collins <rowan.collins@gmail.com <mailto:rowan.collins@gmail.com>> wrote:Following the code by eye, I think the patch would just be the attached - I haven't actually got a build environment to test it in, though, I'm just killing time while a colleague tests something. Using "integer" rather than "int" matches zend_get_type_by_const, which is is used for the "given" part of the message; floats are "double" in that function, which is documented behaviour of gettype [http://php.net/gettype].Ooh, that reminds me of something I've been meaning to file a bug for, and maybe even attempt a patch, if I can understand where it comes from: the message shown *to the user* when an internal function is passed an invalid value uses "double" and "long" instead of "float" and "int".…that’s probably from zend_parse_parameters, no?