From: B dot Steinbrink at gmx dot de
Operating system: Debian Linux
PHP version: 5.2.5
PHP Bug Type: Class/Object related
Bug description: private parent constructor callable through static function
Description:
------------
A class that is derived from a class with a private constructor and which
does not provide its own constructor, can call the private parent
constructor through a static function.
Reproduce code:
---------------
<?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;
Expected result:
----------------
Fatal error: Call to private X::__construct() from invalid context ...
Actual result:
--------------
5
--
Edit bug report at http://bugs.php.net/?id=44141&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44141&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44141&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44141&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44141&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44141&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44141&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44141&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44141&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44141&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44141&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44141&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44141&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44141&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44141&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44141&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44141&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44141&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44141&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44141&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44141&r=mysqlcfg