xref: /PHP-8.0/ext/mysqli/tests/bug38003.phpt (revision d30cd7d7)
1--TEST--
2Bug #38003 (in classes inherited from MySQLi it's possible to call private constructors from invalid context)
3--SKIPIF--
4<?php if (!extension_loaded("mysqli")) print "skip"; ?>
5--FILE--
6<?php
7
8class DB extends mysqli {
9
10    private function __construct($hostname, $username, $password, $database) {
11        var_dump("DB::__construct() called");
12    }
13}
14
15$DB = new DB();
16
17echo "Done\n";
18?>
19--EXPECTF--
20Fatal error: Uncaught Error: Call to private DB::__construct() from global scope in %s
21Stack trace:
22#0 {main}
23  thrown in %s
24