1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/gh14456.phpt
2024-06-06 15:50:41 +01:00

21 lines
453 B
PHP

--TEST--
GH-14456: Attempting to initialize class with private constructor calls destructor
--FILE--
<?php
class PrivateUser {
private function __construct() {}
public function __destruct() {
echo 'Destructor for ', __CLASS__, PHP_EOL;
}
}
try {
new PrivateUser();
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Error: Call to private PrivateUser::__construct() from global scope