|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-05 11:49 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Description: ------------ Problem with create of object class then contruct is private. I use singleton pattern and inheritance and I can create object (no error and warning) if i didn't use inheritance was error (this behavior is ok). Reproduce code: --------------- <?php class DB extends mysqli{ private static $instance; private function __construct($hostname=DB_HOST, $username=DB_USER, $password=DB_PASSWORD, $database=DB_DATABASE){ //parent::__construct($hostname, $username, $password, $database); } public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new DB(); } return self::$instance; } } $DB = new DB(); ?> Expected result: ---------------- Fatal error: Call to private DB::__construct() Actual result: -------------- Everything is ok. No error! No warning!