blob: 021b4810f476618195b0e7ca0a1dfab69b6734e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
--TEST--
Bug #44141 (private parent constructor callable through static function)
--FILE--
<?php
class X
{
public $x;
private function __construct($x)
{
$this->x = $x;
}
}
class Y extends X
{
static public function cheat($x)
{
return new Y($x);
}
}
$y = Y::cheat(5);
echo $y->x, PHP_EOL;
--EXPECTF--
Fatal error: Uncaught EngineException: Call to private X::__construct() from context 'Y' in %sbug44141.php:15
Stack trace:
#0 %s(%d): Y::cheat(5)
#1 {main}
thrown in %sbug44141.php on line 15
|