Use PHP's array behavior for iterator_to_array and CachingIterator

This commit adds a new ZEND_API function array_set_zval_key, that sets
the key in the zval with the same semantics and errors as PHP would
normally do. This new function is used to implement iterator_to_array
and CachingIterator for non-scalar keys. In particular
iterator_to_array() should now behave exactly the same as doing a
manual loop with array insertion:

    foreach ($it as $k => $v) {
	    $array[$k] = $v;
    }