1--TEST--
2Lazy objects: internal classes can not be initialized lazily
3--FILE--
4<?php
5
6$reflector = new ReflectionClass(DateTime::class);
7
8print "# Ghost:\n";
9
10try {
11    $obj = $reflector->newLazyGhost(function ($obj) {
12        var_dump("initializer");
13        $obj->__construct();
14    });
15} catch (Error $e) {
16    printf("%s: %s\n", $e::class, $e->getMessage());
17}
18
19print "# Proxy:\n";
20
21try {
22    $obj = $reflector->newLazyProxy(function ($obj) {
23        var_dump("initializer");
24        $obj->__construct();
25    });
26} catch (Error $e) {
27    printf("%s: %s\n", $e::class, $e->getMessage());
28}
29
30--EXPECTF--
31# Ghost:
32Error: Cannot make instance of internal class lazy: DateTime is internal
33# Proxy:
34Error: Cannot make instance of internal class lazy: DateTime is internal
35