|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68561 connection and php oo
Submitted: 2014-12-07 13:42 UTC Modified: 2014-12-23 19:08 UTC
From: info at djdb dot be Assigned:
Status: No Feedback Package: MySQL related
PHP Version: Irrelevant OS: win7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-12-07 13:42 UTC] info at djdb dot be
lost connection in oophp

so i have 3 object and 
every object wil get a connection to the database(not static)
every object has an __destruct and wil kill his $DB

Test script:
    namespace users;
	class Overview_model extends \Model{
	    private $isinstalled =false;
        private $DB ;
	public function __construct() {
            $conn = new \DBmyConn();//mysqlconnection
            $this->DB = $conn->GET();
            $this->isinstalled = self::isInstalled();
        public function __install(){
        public function isInstalled(){
            return $this->isinstalled ||$this->existTableAccound();

        private function existTableAccound(){
            $database = \DBConn::GET();//PDO=>mysql
            $dbResult = $database->query("SHOW TABLES LIKE '".\DBConn::getTableNameFor('accound')."'");
            return $dbResult->rowCount()==1 ;
        public function save(){
            if(!$this->isinstalled){return false;}
            try {
                    $commit = true;
                    mysql_query("SET AUTOCOMMIT=0",$this->DB);
                    mysql_query("START TRANSACTION",$this->DB);
                    $sql[''] = "";
                    if(!mysql_query($sql[''])){     $commit = false;}
                    $sql[''] = "";
                    if(!mysql_query($sql[''])){     $commit = false;}
                   return ($commit)? mysql_query("COMMIT",$this->DB): mysql_query("ROLLBACK",$this->DB);
            }catch (PDOException $e) {
               return false;
        public function __destruct() {
            @$this->DB->close();// this wil kill al other connections 
             //of new \DBmyConn()
        public function killcon(){

        public function getModelInfo(){
            return "";
        public function getVersionNr(){
            return (float)3.0;

Expected result:
so You can not see anything it is a part of prototype of a cms autosite


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-08 00:16 UTC]
-Status: Open +Status: Feedback
 [2014-12-08 00:16 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2014-12-23 19:08 UTC]
-Status: Feedback +Status: No Feedback
 [2014-12-23 19:08 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 00:01:32 2024 UTC