xref: /PHP-8.2/Zend/tests/generators/clone.phpt (revision e97d5fab)
1--TEST--
2Generators cannot be cloned
3--FILE--
4<?php
5
6function gen() {
7    yield;
8}
9
10$gen = gen();
11clone $gen;
12
13?>
14--EXPECTF--
15Fatal error: Uncaught Error: Trying to clone an uncloneable object of class Generator in %s:%d
16Stack trace:
17#0 {main}
18  thrown in %s on line %d
19