mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
3ae995f03c
This implements a reduced variant of #1226 with just the following change: -Fatal error: Uncaught exception 'EngineException' with message 'Call to private method foo::bar() from context ''' in %s:%d +Fatal error: Uncaught EngineException: Call to private method foo::bar() from context '' in %s:%d The '' wrapper around messages is very weird if the exception message itself contains ''. Futhermore having the message wrapped in '' doesn't work for the "and defined" suffix of TypeExceptions.
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
--TEST--
|
|
ReflectionClass::newInstanceWithoutConstructor()
|
|
--CREDITS--
|
|
Sebastian Bergmann <sebastian@php.net>
|
|
--FILE--
|
|
<?php
|
|
class Foo
|
|
{
|
|
public function __construct()
|
|
{
|
|
print __METHOD__;
|
|
}
|
|
}
|
|
|
|
$class = new ReflectionClass('Foo');
|
|
var_dump($class->newInstanceWithoutConstructor());
|
|
|
|
$class = new ReflectionClass('StdClass');
|
|
var_dump($class->newInstanceWithoutConstructor());
|
|
|
|
$class = new ReflectionClass('DateTime');
|
|
var_dump($class->newInstanceWithoutConstructor());
|
|
|
|
$class = new ReflectionClass('Generator');
|
|
var_dump($class->newInstanceWithoutConstructor());
|
|
--EXPECTF--
|
|
object(Foo)#%d (0) {
|
|
}
|
|
object(stdClass)#%d (0) {
|
|
}
|
|
object(DateTime)#%d (0) {
|
|
}
|
|
|
|
Fatal error: Uncaught ReflectionException: Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor in %sReflectionClass_newInstanceWithoutConstructor.php:%d
|
|
Stack trace:
|
|
#0 %sReflectionClass_newInstanceWithoutConstructor.php(%d): ReflectionClass->newInstanceWithoutConstructor()
|
|
#1 {main}
|
|
thrown in %sReflectionClass_newInstanceWithoutConstructor.php on line %d
|