. Fixed bug #71972 (Cyclic references causing session_start(): Failed to
decode session object). (Laruence)
+- SPL:
+ . Fixed bug #72051 (The reference in CallbackFilterIterator doesn't work as
+ expected). (Laruence)
+
- SQLite3:
. Fixed bug #68849 (bindValue is not using the right data type). (Anatol)
zend_fcall_info *fci = &intern->u.cbfilter->fci;
zend_fcall_info_cache *fcc = &intern->u.cbfilter->fcc;
zval params[3];
- zval result;
if (zend_parse_parameters_none() == FAILURE) {
return;
ZVAL_COPY_VALUE(¶ms[1], &intern->current.key);
ZVAL_COPY_VALUE(¶ms[2], &intern->inner.zobject);
- fci->retval = &result;
+ fci->retval = return_value;
fci->param_count = 3;
fci->params = params;
fci->no_separation = 0;
- if (zend_call_function(fci, fcc) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
+ if (zend_call_function(fci, fcc) != SUCCESS || Z_ISUNDEF_P(return_value)) {
RETURN_FALSE;
}
+
if (EG(exception)) {
- return;
+ RETURN_NULL();
}
- RETURN_ZVAL(&result, 1, 1);
+ /* zend_call_function may change args to IS_REF */
+ ZVAL_COPY_VALUE(&intern->current.data, ¶ms[0]);
+ ZVAL_COPY_VALUE(&intern->current.key, ¶ms[1]);
}
/* }}} */
--- /dev/null
+--TEST--
+Bug #72051 (The reference in CallbackFilterIterator doesn't work as expected)
+--FILE--
+<?php
+
+$data = [
+ [1,2]
+];
+
+$callbackTest = new CallbackFilterIterator(new ArrayIterator($data), function (&$current) {
+ $current['message'] = 'Test message';
+ return true;
+});
+
+$callbackTest->rewind();
+$data = $callbackTest->current();
+$callbackTest->next();
+print_r($data);
+?>
+--EXPECT--
+Array
+(
+ [0] => 1
+ [1] => 2
+ [message] => Test message
+)