1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 17:52:16 +01:00

Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov
2019-09-17 13:15:01 +02:00
4 changed files with 20 additions and 1 deletions

View File

@@ -8600,6 +8600,10 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
count = 0;
break;
}
}
/* if not and the object implements Countable we call its count() method */

View File

@@ -9560,6 +9560,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_
if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
count = 0;
break;
}
}
/* if not and the object implements Countable we call its count() method */
@@ -16689,6 +16693,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL
if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
count = 0;
break;
}
}
/* if not and the object implements Countable we call its count() method */
@@ -47315,6 +47323,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z
if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
count = 0;
break;
}
}
/* if not and the object implements Countable we call its count() method */

View File

@@ -16,7 +16,7 @@ foreach ($a as $key => $val) {
$a = FFI::new("struct {int x,y;}");
try {
var_dump(@count($a));
var_dump(count($a));
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}

View File

@@ -792,6 +792,9 @@ PHP_FUNCTION(count)
if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) {
return;
}
if (EG(exception)) {
return;
}
}
/* if not and the object implements Countable we call its count() method */
if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {