mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Merge branch 'PHP-5.6'
This commit is contained in:
commit
ef214aa3c0
@ -336,7 +336,10 @@ PHP_FUNCTION(count)
|
||||
#ifdef HAVE_SPL
|
||||
/* if not and the object implements Countable we call its count() method */
|
||||
if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
|
||||
zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval);
|
||||
zval *mode_zv;
|
||||
MAKE_STD_ZVAL(mode_zv);
|
||||
Z_LVAL_P(mode_zv) = mode;
|
||||
zend_call_method_with_1_params(&array, NULL, NULL, "count", &retval, mode_zv);
|
||||
if (retval) {
|
||||
convert_to_long_ex(&retval);
|
||||
RETVAL_LONG(Z_LVAL_P(retval));
|
||||
|
17
ext/standard/tests/array/bug67064.phpt
Normal file
17
ext/standard/tests/array/bug67064.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #67064 ()
|
||||
--FILE--
|
||||
<?php
|
||||
class Counter implements Countable {
|
||||
public function count($mode = COUNT_NORMAL) {
|
||||
var_dump($mode == COUNT_RECURSIVE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
$counter = new Counter;
|
||||
var_dump(count($counter, COUNT_RECURSIVE));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
int(1)
|
Loading…
Reference in New Issue
Block a user