|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-28 12:34 UTC] jani@php.net
[2008-11-29 04:43 UTC] lichunguo at ceopen dot cn
[2008-12-06 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
Description: ------------ Class b extends Class A, But Class A __construct is proviate Reproduce code: --------------- cclass a { public static function singles() { return new a; } private function __construct(){} public function test() { $class = 'b'; return new $class; } } class b extends a { public function getstr() { echo 'aaaaa'; } } $b = a::singles(); $obj = $b->test(); $obj->getstr(); Expected result: ---------------- Fatal error: Call to private a::__construct() from context 'a' Because Class b extends Class A, But Class A __construct is proviate. Actual result: -------------- Run above code: Windows: aaaaa Linux: Fatal error: Call to private a::__construct() from context 'a' in /data0/www/www/ui/member/receive.php on line 53 Why windows's result is ?