Hi,
>
>> 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.
>
> i think this should print a warning like other array functions.
> But i looked into the src and this looks more like a casting bug inside this
> function.
Actually most functions use implicit type conversions for this. So I
wouldn't say this should cause a warning.
>
>
> So i think the float value isnt correct casted as int value here. Maybe
> someone else
> can proof this.
Yes, you are right here I think....
the code is
if (ZEND_NUM_ARGS() >= 3 && Z_TYPE_P(length_param) != IS_NULL) {
length = Z_LVAL_P(length_param);
} else {
length = num_in;
}
and afaik should be
if (ZEND_NUM_ARGS() >= 3 && Z_TYPE_P(length_param) != IS_NULL) {
convert_to_long(length_param);
length = Z_LVAL_P(length_param);
} else {
length = num_in;
}
best regards
Moritz Bechler
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php