Hi,

i have tried a current snapshot of PHP 5.3 and have a question regarding
type hinting.

For example when using the function
"array_slice(array $array, int $offset, int $length)"
with a non-integer length parameter, what is the desired behavior?

When calling
   "array_slice($array, 0, (float)2);"
   the resulting array is EMPTY.
When using the right type
   "array_slice($array, 0, (int)2);"
   it works as expected.

Shouldn't there be a notice/warning than just a wrong return value?
In my case there is neither a warning nor does it work as expected.
(perhaps i do something wrong?)

Of course i can use int's, but in my opinion either a warning should be
given or the function should gracefully handle the wrong typed parameter.

Is this problem specific to "array_splice" or the same with other functions? It works with 5.2.x without a problem.

Thank you for any feedback,
Dirk

PS: i posted this to php-general before and someone supposed to better post it to the iternals list

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

Reply via email to