1--TEST-- 2Lazy objects: invalid options 3--FILE-- 4<?php 5 6class C { 7 public $a = 1; 8} 9 10$reflector = new ReflectionClass(C::class); 11 12try { 13 $obj = $reflector->newLazyGhost(function ($obj) { }, -1); 14} catch (ReflectionException $e) { 15 printf("%s: %s\n", $e::class, $e->getMessage()); 16} 17 18try { 19 $obj = $reflector->newLazyProxy(function ($obj) { }, -1); 20} catch (ReflectionException $e) { 21 printf("%s: %s\n", $e::class, $e->getMessage()); 22} 23 24try { 25 // SKIP_DESTRUCTOR is only allowed on resetAsLazyProxy() 26 $obj = $reflector->newLazyGhost(function ($obj) { }, ReflectionClass::SKIP_DESTRUCTOR); 27} catch (ReflectionException $e) { 28 printf("%s: %s\n", $e::class, $e->getMessage()); 29} 30 31$obj = new C(); 32 33try { 34 $reflector->resetAsLazyGhost($obj, function ($obj) { }, -1); 35} catch (ReflectionException $e) { 36 printf("%s: %s\n", $e::class, $e->getMessage()); 37} 38 39try { 40 $reflector->resetAsLazyProxy($obj, function ($obj) { }, -1); 41} catch (ReflectionException $e) { 42 printf("%s: %s\n", $e::class, $e->getMessage()); 43} 44 45?> 46--EXPECT-- 47ReflectionException: ReflectionClass::newLazyGhost(): Argument #2 ($options) contains invalid flags 48ReflectionException: ReflectionClass::newLazyProxy(): Argument #2 ($options) contains invalid flags 49ReflectionException: ReflectionClass::newLazyGhost(): Argument #2 ($options) does not accept ReflectionClass::SKIP_DESTRUCTOR 50ReflectionException: ReflectionClass::resetAsLazyGhost(): Argument #3 ($options) contains invalid flags 51ReflectionException: ReflectionClass::resetAsLazyProxy(): Argument #3 ($options) contains invalid flags 52