mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
The result was ignored, so calling the factory on an uninstantiable subclass ran on a NULL zend_object: object_init_ex() throws, sets the return value to NULL and reports FAILURE, and Z_REFLECTION_P() then offsets backwards from that NULL. Other object_init_ex() calls in this file already test the result. Closes GH-22978
24 lines
443 B
PHP
24 lines
443 B
PHP
--TEST--
|
|
ReflectionMethod::createFromMethodName() called on an abstract subclass
|
|
--FILE--
|
|
<?php
|
|
|
|
class C {
|
|
public function a() {}
|
|
}
|
|
|
|
abstract class R extends ReflectionMethod {}
|
|
|
|
try {
|
|
R::createFromMethodName('C::a');
|
|
} catch (Throwable $e) {
|
|
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
var_dump(ReflectionMethod::createFromMethodName('C::a')->name);
|
|
|
|
?>
|
|
--EXPECT--
|
|
Error: Cannot instantiate abstract class R
|
|
string(1) "a"
|