Bug #68561 [Opn->Fbk]: connection and php oo

From: Date: Mon, 08 Dec 2014 00:16:22 +0000
Subject: Bug #68561 [Opn->Fbk]: connection and php oo
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188955@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68561&edit=1 ID: 68561 Updated by: requinix@php.net Reported by: info at djdb dot be Summary: connection and php oo -Status: Open +Status: Feedback Type: Bug Package: MySQL related Operating System: win7 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2014-12-07 13:42:13] info at djdb dot be Description: ------------ 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: --------------- <?php 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) { @mysql_query("ROLLBACK",$this->DB); return false; } } public function __destruct() { @$this->DB->close();// this wil kill al other connections //of new \DBmyConn() $this->DB=null; } public function killcon(){ mysql_query("ROLLBACK",$this->DB); $this->__destruct(); } public function getModelInfo(){ return "UsersOverview.model.info"; } 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68561&edit=1

« previous php.bugs (#188955) next »