Bug #68561 [NEW]: connection and php oo

From: Date: Sun, 07 Dec 2014 13:42:15 +0000
Subject: Bug #68561 [NEW]: connection and php oo
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188954@lists.php.net to get a copy of this message
From: info at djdb dot be Operating system: win7 PHP version: Irrelevant Package: MySQL related Bug Type: Bug Bug description:connection and php oo 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 bug report at https://bugs.php.net/bug.php?id=68561&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68561&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68561&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68561&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68561&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68561&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68561&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68561&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68561&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68561&r=support Expected behavior: https://bugs.php.net/fix.php?id=68561&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68561&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68561&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68561&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68561&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68561&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68561&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68561&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68561&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68561&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68561&r=mysqlcfg

« previous php.bugs (#188954) next »