summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/throw_not_an_exception.phpt
blob: 920d8eb8473b2f1202d2d966034da426193121d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Generator::throw() with something that's not an exception
--FILE--
<?php

function gen() {
    yield;
}

$gen = gen();
$gen->throw(new stdClass);

?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in %s:%d
Stack trace:
#0 [internal function]: gen()
#1 %s(%d): Generator->throw(Object(stdClass))
#2 {main}
  thrown in %s on line %d