From 025a95ea909d449e14cb22564983fb005e3f8c06 Mon Sep 17 00:00:00 2001
From: Oleg Pudeyev <oleg@bsdpower.com>
Date: Wed, 9 Mar 2011 21:50:45 -0500
Subject: [ticket/10205] Account for potentially missing extensions in dbal.

PHPBB3-10205
---
 phpBB/includes/db/oracle.php | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

(limited to 'phpBB/includes/db/oracle.php')

diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 62b36aa8bf..42f5de1b24 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -25,6 +25,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
 class dbal_oracle extends dbal
 {
 	var $last_query_text = '';
+	var $connect_error = '';
 
 	/**
 	* Connect to server
@@ -48,7 +49,33 @@ class dbal_oracle extends dbal
 			$connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database;
 		}
 
-		$this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
+		if ($new_link)
+		{
+			if (!function_exists('ocinlogon'))
+			{
+				$this->connect_error = 'ocinlogon function does not exist, is oci extension installed?';
+				return $this->sql_error('');
+			}
+			$this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8');
+		}
+		else if ($this->persistency)
+		{
+			if (!function_exists('ociplogon'))
+			{
+				$this->connect_error = 'ociplogon function does not exist, is oci extension installed?';
+				return $this->sql_error('');
+			}
+			$this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8');
+		}
+		else
+		{
+			if (!function_exists('ocilogon'))
+			{
+				$this->connect_error = 'ocilogon function does not exist, is oci extension installed?';
+				return $this->sql_error('');
+			}
+			$this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
+		}
 
 		return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
 	}
-- 
cgit v1.2.1


From 9f549e8249acbd82b68e961a6e0a31de47d9ca32 Mon Sep 17 00:00:00 2001
From: Oleg Pudeyev <oleg@bsdpower.com>
Date: Tue, 4 Dec 2012 04:50:41 -0500
Subject: [ticket/10205] Fix remaining db drivers.

PHPBB3-10205
---
 phpBB/includes/db/oracle.php | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

(limited to 'phpBB/includes/db/oracle.php')

diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 42f5de1b24..b234d8b45e 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -674,17 +674,27 @@ class dbal_oracle extends dbal
 	*/
 	function _sql_error()
 	{
-		$error = @ocierror();
-		$error = (!$error) ? @ocierror($this->query_result) : $error;
-		$error = (!$error) ? @ocierror($this->db_connect_id) : $error;
-
-		if ($error)
+		if (function_exists('ocierror'))
 		{
-			$this->last_error_result = $error;
+			$error = @ocierror();
+			$error = (!$error) ? @ocierror($this->query_result) : $error;
+			$error = (!$error) ? @ocierror($this->db_connect_id) : $error;
+
+			if ($error)
+			{
+				$this->last_error_result = $error;
+			}
+			else
+			{
+				$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
+			}
 		}
 		else
 		{
-			$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
+			$error = array(
+				'message'	=> $this->connect_error,
+				'code'		=> '',
+			);
 		}
 
 		return $error;
-- 
cgit v1.2.1


From 40db60e45f3d7af01a96f9da6b36db2606b3d147 Mon Sep 17 00:00:00 2001
From: Oleg Pudeyev <oleg@bsdpower.com>
Date: Tue, 4 Dec 2012 16:07:02 -0500
Subject: [ticket/10205] Fix a parse error in oracle driver.

PHPBB3-10205
---
 phpBB/includes/db/oracle.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/includes/db/oracle.php')

diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index b234d8b45e..4a7a4ecc8c 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -74,7 +74,7 @@ class dbal_oracle extends dbal
 				$this->connect_error = 'ocilogon function does not exist, is oci extension installed?';
 				return $this->sql_error('');
 			}
-			$this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
+			$this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8');
 		}
 
 		return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
-- 
cgit v1.2.1