--TEST-- Test sizeof() function : object functionality - objects without Countable interface --FILE-- getMessage() . \PHP_EOL; } echo "COUNT_NORMAL Mode: "; try { var_dump( sizeof($var, COUNT_NORMAL) ); } catch (\TypeError $e) { echo $e->getMessage() . \PHP_EOL; } echo "COUNT_RECURSIVE Mode: "; try { var_dump( sizeof($var, COUNT_RECURSIVE) ); } catch (\TypeError $e) { echo $e->getMessage() . \PHP_EOL; } $counter++; } echo "Done"; ?> --EXPECT-- *** Testing sizeof() : object functionality *** --- Testing sizeof() with objects which doesn't implement Countable interface --- -- Iteration 1 -- Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test given -- Iteration 2 -- Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test1 given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test1 given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test1 given -- Iteration 3 -- Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test2 given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test2 given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, test2 given -- Iteration 4 -- Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, child_test2 given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, child_test2 given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, child_test2 given -- Iteration 5 -- Default Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, concrete_class given COUNT_NORMAL Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, concrete_class given COUNT_RECURSIVE Mode: sizeof(): Argument #1 ($value) must be of type Countable|array, concrete_class given Done