summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/throw_not_an_exception.phpt
blob: a212b5ae420f10b6c737f10affe0aea24cc09763 (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 exception 'Error' with message 'Exceptions must be valid objects implementing 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