Re: hasType() for internal function parameters?
| From: | Stanislav Malyshev | Date: | Mon, 22 Jun 2015 23:54:20 +0000 |
| Subject: | Re: hasType() for internal function parameters? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86800@lists.php.net to get a copy of this message | ||
Hi!
So I tried to remove the checks for ZEND_ACC_HAS_TYPE_HINTS:
https://github.com/php/php-src/pull/1354
Turns out there is a lot of tests that assume function with wrong
arguments throws Error, but ZPP and type checks work differently - ZPP
first checks argument number (and doesn't throw if number is wrong but
instead creates warning), while type checks (that shouldn't really
happen on internals but do) check types first and not check argument number.
So I wonder which way is the best to proceed here. Looks like this comes
from 5.6 where internal function types were verified in executor:
https://github.com/php/php-src/blob/PHP-5.6/Zend/zend_vm_def.h#L1974
I'm not sure what to do with it - on one side, I think ZPP should handle
it for internal functions, otherwise we're doing the same work twice. On
the other side, that would be pretty substantial, even if maybe correct,
BC break. Should we keep the ZEND_ACC_HAS_TYPE_HINTS type checks and
accept the fact that this way we're checking everything twice, or should
be clean it up?
--
Stas Malyshev
smalyshev@gmail.com