diff options
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/cache/driver/base.php | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/cache/driver/file.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/cache/driver/memory.php | 7 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/driver.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssql.php | 56 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssql_odbc.php | 32 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mssqlnative.php | 34 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mysql.php | 56 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/mysqli.php | 49 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/oracle.php | 59 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/postgres.php | 45 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/sqlite.php | 34 | ||||
| -rw-r--r-- | phpBB/phpbb/db/driver/sqlite3.php | 12 | ||||
| -rw-r--r-- | phpBB/phpbb/event/md_exporter.php | 11 | ||||
| -rw-r--r-- | phpBB/phpbb/search/fulltext_native.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/template/twig/environment.php | 30 | ||||
| -rw-r--r-- | phpBB/phpbb/template/twig/lexer.php | 5 | ||||
| -rw-r--r-- | phpBB/phpbb/template/twig/twig.php | 39 | 
18 files changed, 303 insertions, 186 deletions
| diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index 4c20ad916d..b357431589 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -90,14 +90,14 @@ abstract class base implements \phpbb\cache\driver\driver_interface  	{  		// Remove extra spaces and tabs  		$query = preg_replace('/[\n\r\s\t]+/', ' ', $query); +		$query_id = md5($query); -		if (($rowset = $this->_read('sql_' . md5($query))) === false) +		if (($result = $this->_read('sql_' . $query_id)) === false)  		{  			return false;  		} -		$query_id = sizeof($this->sql_rowset); -		$this->sql_rowset[$query_id] = $rowset; +		$this->sql_rowset[$query_id] = $result;  		$this->sql_row_pointer[$query_id] = 0;  		return $query_id; diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index fd5bce4515..adfe87b740 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -305,7 +305,7 @@ class file extends \phpbb\cache\driver\base  		// Remove extra spaces and tabs  		$query = preg_replace('/[\n\r\s\t]+/', ' ', $query); -		$query_id = sizeof($this->sql_rowset); +		$query_id = md5($query);  		$this->sql_rowset[$query_id] = array();  		$this->sql_row_pointer[$query_id] = 0; @@ -315,7 +315,7 @@ class file extends \phpbb\cache\driver\base  		}  		$db->sql_freeresult($query_result); -		if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query)) +		if ($this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl + time(), $query))  		{  			return $query_id;  		} diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 56308be8da..add87b9bfa 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -203,7 +203,7 @@ abstract class memory extends \phpbb\cache\driver\base  	{  		// Remove extra spaces and tabs  		$query = preg_replace('/[\n\r\s\t]+/', ' ', $query); -		$hash = md5($query); +		$query_id = md5($query);  		// determine which tables this query belongs to  		// Some queries use backticks, namely the get_database_size() query @@ -232,14 +232,13 @@ abstract class memory extends \phpbb\cache\driver\base  				$temp = array();  			} -			$temp[$hash] = true; +			$temp[$query_id] = true;  			// This must never expire  			$this->_write('sql_' . $table_name, $temp, 0);  		}  		// store them in the right place -		$query_id = sizeof($this->sql_rowset);  		$this->sql_rowset[$query_id] = array();  		$this->sql_row_pointer[$query_id] = 0; @@ -249,7 +248,7 @@ abstract class memory extends \phpbb\cache\driver\base  		}  		$db->sql_freeresult($query_result); -		$this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); +		$this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl);  		return $query_id;  	} diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 9fc04d47a1..4be315a154 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -271,7 +271,7 @@ abstract class driver implements driver_interface  			$query_id = $this->query_result;  		} -		if ($query_id !== false) +		if ($query_id)  		{  			$result = array();  			while ($row = $this->sql_fetchrow($query_id)) @@ -302,7 +302,7 @@ abstract class driver implements driver_interface  			return $cache->sql_rowseek($rownum, $query_id);  		} -		if ($query_id === false) +		if (!$query_id)  		{  			return false;  		} @@ -310,7 +310,7 @@ abstract class driver implements driver_interface  		$this->sql_freeresult($query_id);  		$query_id = $this->sql_query($this->last_query_text); -		if ($query_id === false) +		if (!$query_id)  		{  			return false;  		} @@ -339,7 +339,7 @@ abstract class driver implements driver_interface  			$query_id = $this->query_result;  		} -		if ($query_id !== false) +		if ($query_id)  		{  			if ($rownum !== false)  			{ diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php index f9ea884ce2..dfdbfe15e6 100644 --- a/phpBB/phpbb/db/driver/mssql.php +++ b/phpBB/phpbb/db/driver/mssql.php @@ -71,8 +71,8 @@ class mssql extends \phpbb\db\driver\driver  			$row = false;  			if ($result_id)  			{ -				$row = @mssql_fetch_assoc($result_id); -				@mssql_free_result($result_id); +				$row = mssql_fetch_assoc($result_id); +				mssql_free_result($result_id);  			}  			$this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; @@ -161,12 +161,17 @@ class mssql extends \phpbb\db\driver\driver  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) +				else if (strpos($query, 'SELECT') === 0 && $this->query_result !== true)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  				} @@ -241,12 +246,12 @@ class mssql extends \phpbb\db\driver\driver  			return $cache->sql_fetchrow($query_id);  		} -		if ($query_id === false) +		if (!$query_id || $query_id === true)  		{  			return false;  		} -		$row = @mssql_fetch_assoc($query_id); +		$row = mssql_fetch_assoc($query_id);  		// I hope i am able to remove this later... hopefully only a PHP or MSSQL bug  		if ($row) @@ -272,12 +277,17 @@ class mssql extends \phpbb\db\driver\driver  			$query_id = $this->query_result;  		} +		if ($query_id === true) +		{ +			return false; +		} +  		if ($cache && $cache->sql_exists($query_id))  		{  			return $cache->sql_rowseek($rownum, $query_id);  		} -		return ($query_id !== false) ? @mssql_data_seek($query_id, $rownum) : false; +		return ($query_id) ? @mssql_data_seek($query_id, $rownum) : false;  	}  	/** @@ -288,12 +298,12 @@ class mssql extends \phpbb\db\driver\driver  		$result_id = @mssql_query('SELECT SCOPE_IDENTITY()', $this->db_connect_id);  		if ($result_id)  		{ -			if ($row = @mssql_fetch_assoc($result_id)) +			if ($row = mssql_fetch_assoc($result_id))  			{ -				@mssql_free_result($result_id); +				mssql_free_result($result_id);  				return $row['computed'];  			} -			@mssql_free_result($result_id); +			mssql_free_result($result_id);  		}  		return false; @@ -311,6 +321,11 @@ class mssql extends \phpbb\db\driver\driver  			$query_id = $this->query_result;  		} +		if ($query_id === true) +		{ +			return false; +		} +  		if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))  		{  			return $cache->sql_freeresult($query_id); @@ -319,7 +334,7 @@ class mssql extends \phpbb\db\driver\driver  		if (isset($this->open_queries[(int) $query_id]))  		{  			unset($this->open_queries[(int) $query_id]); -			return @mssql_free_result($query_id); +			return mssql_free_result($query_id);  		}  		return false; @@ -376,9 +391,9 @@ class mssql extends \phpbb\db\driver\driver  			$result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);  			if ($result_id)  			{ -				$row = @mssql_fetch_assoc($result_id); +				$row = mssql_fetch_assoc($result_id);  				$error['code'] = $row['code']; -				@mssql_free_result($result_id); +				mssql_free_result($result_id);  			}  			// Get full error message if possible @@ -389,12 +404,12 @@ class mssql extends \phpbb\db\driver\driver  			if ($result_id)  			{ -				$row = @mssql_fetch_assoc($result_id); +				$row = mssql_fetch_assoc($result_id);  				if (!empty($row['message']))  				{  					$error['message'] .= '<br />' . $row['message'];  				} -				@mssql_free_result($result_id); +				mssql_free_result($result_id);  			}  		}  		else @@ -440,13 +455,13 @@ class mssql extends \phpbb\db\driver\driver  				if ($result = @mssql_query($query, $this->db_connect_id))  				{  					@mssql_next_result($result); -					while ($row = @mssql_fetch_row($result)) +					while ($row = mssql_fetch_row($result))  					{  						$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  					}  				}  				@mssql_query('SET SHOWPLAN_TEXT OFF;', $this->db_connect_id); -				@mssql_free_result($result); +				mssql_free_result($result);  				if ($html_table)  				{ @@ -459,11 +474,14 @@ class mssql extends \phpbb\db\driver\driver  				$endtime = $endtime[0] + $endtime[1];  				$result = @mssql_query($query, $this->db_connect_id); -				while ($void = @mssql_fetch_assoc($result)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					while ($void = mssql_fetch_assoc($result)) +					{ +						// Take the time spent on parsing rows into account +					} +					mssql_free_result($result);  				} -				@mssql_free_result($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php index 8e5d4c7a4c..9d9ad603e0 100644 --- a/phpBB/phpbb/db/driver/mssql_odbc.php +++ b/phpBB/phpbb/db/driver/mssql_odbc.php @@ -98,8 +98,8 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base  			$row = false;  			if ($result_id)  			{ -				$row = @odbc_fetch_array($result_id); -				@odbc_free_result($result_id); +				$row = odbc_fetch_array($result_id); +				odbc_free_result($result_id);  			}  			$this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; @@ -181,12 +181,17 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) +				else if (strpos($query, 'SELECT') === 0)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  				} @@ -261,7 +266,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base  			return $cache->sql_fetchrow($query_id);  		} -		return ($query_id !== false) ? @odbc_fetch_array($query_id) : false; +		return ($query_id) ? odbc_fetch_array($query_id) : false;  	}  	/** @@ -273,13 +278,13 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base  		if ($result_id)  		{ -			if (@odbc_fetch_array($result_id)) +			if (odbc_fetch_array($result_id))  			{ -				$id = @odbc_result($result_id, 1); -				@odbc_free_result($result_id); +				$id = odbc_result($result_id, 1); +				odbc_free_result($result_id);  				return $id;  			} -			@odbc_free_result($result_id); +			odbc_free_result($result_id);  		}  		return false; @@ -305,7 +310,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base  		if (isset($this->open_queries[(int) $query_id]))  		{  			unset($this->open_queries[(int) $query_id]); -			return @odbc_free_result($query_id); +			return odbc_free_result($query_id);  		}  		return false; @@ -360,11 +365,14 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base  				$endtime = $endtime[0] + $endtime[1];  				$result = @odbc_exec($this->db_connect_id, $query); -				while ($void = @odbc_fetch_array($result)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					while ($void = odbc_fetch_array($result)) +					{ +						// Take the time spent on parsing rows into account +					} +					odbc_free_result($result);  				} -				@odbc_free_result($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 46a9b3a477..50dce35baa 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -154,12 +154,17 @@ class mssqlnative extends \phpbb\db\driver\mssql_base  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) +				else if (strpos($query, 'SELECT') === 0)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  				} @@ -242,12 +247,12 @@ class mssqlnative extends \phpbb\db\driver\mssql_base  			return $cache->sql_fetchrow($query_id);  		} -		if ($query_id === false) +		if (!$query_id)  		{  			return false;  		} -		$row = @sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); +		$row = sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC);  		if ($row)  		{ @@ -272,11 +277,11 @@ class mssqlnative extends \phpbb\db\driver\mssql_base  	{  		$result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY'); -		if ($result_id !== false) +		if ($result_id)  		{ -			$row = @sqlsrv_fetch_array($result_id); +			$row = sqlsrv_fetch_array($result_id);  			$id = $row[0]; -			@sqlsrv_free_stmt($result_id); +			sqlsrv_free_stmt($result_id);  			return $id;  		}  		else @@ -305,7 +310,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base  		if (isset($this->open_queries[(int) $query_id]))  		{  			unset($this->open_queries[(int) $query_id]); -			return @sqlsrv_free_stmt($query_id); +			return sqlsrv_free_stmt($query_id);  		}  		return false; @@ -378,14 +383,14 @@ class mssqlnative extends \phpbb\db\driver\mssql_base  				@sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;');  				if ($result = @sqlsrv_query($this->db_connect_id, $query))  				{ -					@sqlsrv_next_result($result); -					while ($row = @sqlsrv_fetch_array($result)) +					sqlsrv_next_result($result); +					while ($row = sqlsrv_fetch_array($result))  					{  						$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  					} +					sqlsrv_free_stmt($result);  				}  				@sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); -				@sqlsrv_free_stmt($result);  				if ($html_table)  				{ @@ -398,11 +403,14 @@ class mssqlnative extends \phpbb\db\driver\mssql_base  				$endtime = $endtime[0] + $endtime[1];  				$result = @sqlsrv_query($this->db_connect_id, $query); -				while ($void = @sqlsrv_fetch_array($result)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					while ($void = sqlsrv_fetch_array($result)) +					{ +						// Take the time spent on parsing rows into account +					} +					sqlsrv_free_stmt($result);  				} -				@sqlsrv_free_stmt($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index e93c7239e8..a94e88b331 100644 --- a/phpBB/phpbb/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php @@ -70,9 +70,16 @@ class mysql extends \phpbb\db\driver\mysql_base  					if (version_compare($this->sql_server_info(true), '5.0.2', '>='))  					{  						$result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id); -						$row = @mysql_fetch_assoc($result); -						@mysql_free_result($result); -						$modes = array_map('trim', explode(',', $row['sql_mode'])); +						if ($result) +						{ +							$row = mysql_fetch_assoc($result); +							mysql_free_result($result); +							$modes = array_map('trim', explode(',', $row['sql_mode'])); +						} +						else +						{ +							$modes = array(); +						}  						// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES  						if (!in_array('TRADITIONAL', $modes)) @@ -114,14 +121,17 @@ class mysql extends \phpbb\db\driver\mysql_base  		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysql_version')) === false)  		{  			$result = @mysql_query('SELECT VERSION() AS version', $this->db_connect_id); -			$row = @mysql_fetch_assoc($result); -			@mysql_free_result($result); +			if ($result) +			{ +				$row = mysql_fetch_assoc($result); +				mysql_free_result($result); -			$this->sql_server_version = $row['version']; +				$this->sql_server_version = $row['version']; -			if (!empty($cache) && $use_cache) -			{ -				$cache->put('mysql_version', $this->sql_server_version); +				if (!empty($cache) && $use_cache) +				{ +					$cache->put('mysql_version', $this->sql_server_version); +				}  			}  		} @@ -190,12 +200,17 @@ class mysql extends \phpbb\db\driver\mysql_base  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) +				else if (strpos($query, 'SELECT') === 0)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  				} @@ -257,7 +272,7 @@ class mysql extends \phpbb\db\driver\mysql_base  			return $cache->sql_fetchrow($query_id);  		} -		return ($query_id !== false) ? @mysql_fetch_assoc($query_id) : false; +		return ($query_id) ? mysql_fetch_assoc($query_id) : false;  	}  	/** @@ -308,7 +323,7 @@ class mysql extends \phpbb\db\driver\mysql_base  		if (isset($this->open_queries[(int) $query_id]))  		{  			unset($this->open_queries[(int) $query_id]); -			return @mysql_free_result($query_id); +			return mysql_free_result($query_id);  		}  		return false; @@ -411,12 +426,12 @@ class mysql extends \phpbb\db\driver\mysql_base  					if ($result = @mysql_query("EXPLAIN $explain_query", $this->db_connect_id))  					{ -						while ($row = @mysql_fetch_assoc($result)) +						while ($row = mysql_fetch_assoc($result))  						{  							$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  						} +						mysql_free_result($result);  					} -					@mysql_free_result($result);  					if ($html_table)  					{ @@ -431,7 +446,7 @@ class mysql extends \phpbb\db\driver\mysql_base  						if ($result = @mysql_query('SHOW PROFILE ALL;', $this->db_connect_id))  						{  							$this->html_hold .= '<br />'; -							while ($row = @mysql_fetch_assoc($result)) +							while ($row = mysql_fetch_assoc($result))  							{  								// make <unknown> HTML safe  								if (!empty($row['Source_function'])) @@ -449,8 +464,8 @@ class mysql extends \phpbb\db\driver\mysql_base  								}  								$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  							} +							mysql_free_result($result);  						} -						@mysql_free_result($result);  						if ($html_table)  						{ @@ -468,11 +483,14 @@ class mysql extends \phpbb\db\driver\mysql_base  				$endtime = $endtime[0] + $endtime[1];  				$result = @mysql_query($query, $this->db_connect_id); -				while ($void = @mysql_fetch_assoc($result)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					while ($void = mysql_fetch_assoc($result)) +					{ +						// Take the time spent on parsing rows into account +					} +					mysql_free_result($result);  				} -				@mysql_free_result($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php index 2ed08211ad..debc3cc523 100644 --- a/phpBB/phpbb/db/driver/mysqli.php +++ b/phpBB/phpbb/db/driver/mysqli.php @@ -75,9 +75,10 @@ class mysqli extends \phpbb\db\driver\mysql_base  			if (version_compare($this->sql_server_info(true), '5.0.2', '>='))  			{  				$result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode'); -				if ($result !== null) +				if ($result)  				{ -					$row = @mysqli_fetch_assoc($result); +					$row = mysqli_fetch_assoc($result); +					mysqli_free_result($result);  					$modes = array_map('trim', explode(',', $row['sql_mode']));  				} @@ -85,7 +86,6 @@ class mysqli extends \phpbb\db\driver\mysql_base  				{  					$modes = array();  				} -				@mysqli_free_result($result);  				// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES  				if (!in_array('TRADITIONAL', $modes)) @@ -120,9 +120,10 @@ class mysqli extends \phpbb\db\driver\mysql_base  		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false)  		{  			$result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version'); -			if ($result !== null) +			if ($result)  			{ -				$row = @mysqli_fetch_assoc($result); +				$row = mysqli_fetch_assoc($result); +				mysqli_free_result($result);  				$this->sql_server_version = $row['version']; @@ -131,7 +132,6 @@ class mysqli extends \phpbb\db\driver\mysql_base  					$cache->put('mysqli_version', $this->sql_server_version);  				}  			} -			@mysqli_free_result($result);  		}  		return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version; @@ -203,6 +203,11 @@ class mysqli extends \phpbb\db\driver\mysql_base  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); @@ -246,9 +251,9 @@ class mysqli extends \phpbb\db\driver\mysql_base  			return $cache->sql_fetchrow($query_id);  		} -		if ($query_id !== false && $query_id !== null) +		if ($query_id)  		{ -			$result = @mysqli_fetch_assoc($query_id); +			$result = mysqli_fetch_assoc($query_id);  			return $result !== null ? $result : false;  		} @@ -272,7 +277,7 @@ class mysqli extends \phpbb\db\driver\mysql_base  			return $cache->sql_rowseek($rownum, $query_id);  		} -		return ($query_id !== false) ? @mysqli_data_seek($query_id, $rownum) : false; +		return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false;  	}  	/** @@ -300,7 +305,17 @@ class mysqli extends \phpbb\db\driver\mysql_base  			return $cache->sql_freeresult($query_id);  		} -		return @mysqli_free_result($query_id); +		if (!$query_id) +		{ +			return false; +		} + +		if ($query_id === true) +		{ +			return true; +		} + +		return mysqli_free_result($query_id);  	}  	/** @@ -399,12 +414,12 @@ class mysqli extends \phpbb\db\driver\mysql_base  					if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query"))  					{ -						while ($row = @mysqli_fetch_assoc($result)) +						while ($row = mysqli_fetch_assoc($result))  						{  							$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  						} +						mysqli_free_result($result);  					} -					@mysqli_free_result($result);  					if ($html_table)  					{ @@ -419,7 +434,7 @@ class mysqli extends \phpbb\db\driver\mysql_base  						if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;'))  						{  							$this->html_hold .= '<br />'; -							while ($row = @mysqli_fetch_assoc($result)) +							while ($row = mysqli_fetch_assoc($result))  							{  								// make <unknown> HTML safe  								if (!empty($row['Source_function'])) @@ -437,8 +452,8 @@ class mysqli extends \phpbb\db\driver\mysql_base  								}  								$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  							} +							mysqli_free_result($result);  						} -						@mysqli_free_result($result);  						if ($html_table)  						{ @@ -456,14 +471,14 @@ class mysqli extends \phpbb\db\driver\mysql_base  				$endtime = $endtime[0] + $endtime[1];  				$result = @mysqli_query($this->db_connect_id, $query); -				if ($result !== null) +				if ($result)  				{ -					while ($void = @mysqli_fetch_assoc($result)) +					while ($void = mysqli_fetch_assoc($result))  					{  						// Take the time spent on parsing rows into account  					} +					mysqli_free_result($result);  				} -				@mysqli_free_result($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index 6dcab5dd7d..89e1b68aac 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -439,12 +439,17 @@ class oracle extends \phpbb\db\driver\driver  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) +				else if (strpos($query, 'SELECT') === 0)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  				} @@ -499,10 +504,10 @@ class oracle extends \phpbb\db\driver\driver  			return $cache->sql_fetchrow($query_id);  		} -		if ($query_id !== false) +		if ($query_id)  		{  			$row = array(); -			$result = @ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); +			$result = ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS);  			if (!$result || !$row)  			{ @@ -550,7 +555,7 @@ class oracle extends \phpbb\db\driver\driver  			return $cache->sql_rowseek($rownum, $query_id);  		} -		if ($query_id === false) +		if (!$query_id)  		{  			return false;  		} @@ -583,18 +588,24 @@ class oracle extends \phpbb\db\driver\driver  			{  				$query = 'SELECT ' . $tablename[1] . '_seq.currval FROM DUAL';  				$stmt = @ociparse($this->db_connect_id, $query); -				@ociexecute($stmt, OCI_DEFAULT); +				if ($stmt) +				{ +					$success = @ociexecute($stmt, OCI_DEFAULT); -				$temp_result = @ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); -				@ocifreestatement($stmt); +					if ($success) +					{ +						$temp_result = ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); +						ocifreestatement($stmt); -				if ($temp_result) -				{ -					return $temp_array['CURRVAL']; -				} -				else -				{ -					return false; +						if ($temp_result) +						{ +							return $temp_array['CURRVAL']; +						} +						else +						{ +							return false; +						} +					}  				}  			}  		} @@ -622,7 +633,7 @@ class oracle extends \phpbb\db\driver\driver  		if (isset($this->open_queries[(int) $query_id]))  		{  			unset($this->open_queries[(int) $query_id]); -			return @ocifreestatement($query_id); +			return ocifreestatement($query_id);  		}  		return false; @@ -787,14 +798,20 @@ class oracle extends \phpbb\db\driver\driver  				$endtime = $endtime[0] + $endtime[1];  				$result = @ociparse($this->db_connect_id, $query); -				$success = @ociexecute($result, OCI_DEFAULT); -				$row = array(); - -				while (@ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					$success = @ociexecute($result, OCI_DEFAULT); +					if ($success) +					{ +						$row = array(); + +						while (ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) +						{ +							// Take the time spent on parsing rows into account +						} +						@ocifreestatement($result); +					}  				} -				@ocifreestatement($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index a3b9aa4c6b..44476612c3 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -123,14 +123,17 @@ class postgres extends \phpbb\db\driver\driver  		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false)  		{  			$query_id = @pg_query($this->db_connect_id, 'SELECT VERSION() AS version'); -			$row = @pg_fetch_assoc($query_id, null); -			@pg_free_result($query_id); +			if ($query_id) +			{ +				$row = pg_fetch_assoc($query_id, null); +				pg_free_result($query_id); -			$this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; +				$this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; -			if (!empty($cache) && $use_cache) -			{ -				$cache->put('pgsql_version', $this->sql_server_version); +				if (!empty($cache) && $use_cache) +				{ +					$cache->put('pgsql_version', $this->sql_server_version); +				}  			}  		} @@ -200,12 +203,17 @@ class postgres extends \phpbb\db\driver\driver  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) +				else if (strpos($query, 'SELECT') === 0)  				{  					$this->open_queries[(int) $this->query_result] = $this->query_result;  				} @@ -275,7 +283,7 @@ class postgres extends \phpbb\db\driver\driver  			return $cache->sql_fetchrow($query_id);  		} -		return ($query_id !== false) ? @pg_fetch_assoc($query_id, null) : false; +		return ($query_id) ? pg_fetch_assoc($query_id, null) : false;  	}  	/** @@ -295,7 +303,7 @@ class postgres extends \phpbb\db\driver\driver  			return $cache->sql_rowseek($rownum, $query_id);  		} -		return ($query_id !== false) ? @pg_result_seek($query_id, $rownum) : false; +		return ($query_id) ? @pg_result_seek($query_id, $rownum) : false;  	}  	/** @@ -317,8 +325,8 @@ class postgres extends \phpbb\db\driver\driver  					return false;  				} -				$temp_result = @pg_fetch_assoc($temp_q_id, null); -				@pg_free_result($query_id); +				$temp_result = pg_fetch_assoc($temp_q_id, null); +				pg_free_result($query_id);  				return ($temp_result) ? $temp_result['last_value'] : false;  			} @@ -347,7 +355,7 @@ class postgres extends \phpbb\db\driver\driver  		if (isset($this->open_queries[(int) $query_id]))  		{  			unset($this->open_queries[(int) $query_id]); -			return @pg_free_result($query_id); +			return pg_free_result($query_id);  		}  		return false; @@ -453,12 +461,12 @@ class postgres extends \phpbb\db\driver\driver  					if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query"))  					{ -						while ($row = @pg_fetch_assoc($result, null)) +						while ($row = pg_fetch_assoc($result, null))  						{  							$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);  						} +						pg_free_result($result);  					} -					@pg_free_result($result);  					if ($html_table)  					{ @@ -473,11 +481,14 @@ class postgres extends \phpbb\db\driver\driver  				$endtime = $endtime[0] + $endtime[1];  				$result = @pg_query($this->db_connect_id, $query); -				while ($void = @pg_fetch_assoc($result, null)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					while ($void = pg_fetch_assoc($result, null)) +					{ +						// Take the time spent on parsing rows into account +					} +					pg_free_result($result);  				} -				@pg_free_result($result);  				$splittime = explode(' ', microtime());  				$splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php index d5da0e2438..8e205ebb81 100644 --- a/phpBB/phpbb/db/driver/sqlite.php +++ b/phpBB/phpbb/db/driver/sqlite.php @@ -70,13 +70,16 @@ class sqlite extends \phpbb\db\driver\driver  		if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false)  		{  			$result = @sqlite_query('SELECT sqlite_version() AS version', $this->db_connect_id); -			$row = @sqlite_fetch_array($result, SQLITE_ASSOC); +			if ($result) +			{ +				$row = sqlite_fetch_array($result, SQLITE_ASSOC); -			$this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0; +				$this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0; -			if (!empty($cache) && $use_cache) -			{ -				$cache->put('sqlite_version', $this->sql_server_version); +				if (!empty($cache) && $use_cache) +				{ +					$cache->put('sqlite_version', $this->sql_server_version); +				}  			}  		} @@ -145,14 +148,14 @@ class sqlite extends \phpbb\db\driver\driver  					$this->sql_time += microtime(true) - $this->curtime;  				} -				if ($cache && $cache_ttl) +				if (!$this->query_result)  				{ -					$this->open_queries[(int) $this->query_result] = $this->query_result; -					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); +					return false;  				} -				else if (strpos($query, 'SELECT') === 0 && $this->query_result) + +				if ($cache && $cache_ttl)  				{ -					$this->open_queries[(int) $this->query_result] = $this->query_result; +					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);  				}  			}  			else if (defined('DEBUG')) @@ -211,7 +214,7 @@ class sqlite extends \phpbb\db\driver\driver  			return $cache->sql_fetchrow($query_id);  		} -		return ($query_id !== false) ? @sqlite_fetch_array($query_id, SQLITE_ASSOC) : false; +		return ($query_id) ? sqlite_fetch_array($query_id, SQLITE_ASSOC) : false;  	}  	/** @@ -231,7 +234,7 @@ class sqlite extends \phpbb\db\driver\driver  			return $cache->sql_rowseek($rownum, $query_id);  		} -		return ($query_id !== false) ? @sqlite_seek($query_id, $rownum) : false; +		return ($query_id) ? @sqlite_seek($query_id, $rownum) : false;  	}  	/** @@ -362,9 +365,12 @@ class sqlite extends \phpbb\db\driver\driver  				$endtime = $endtime[0] + $endtime[1];  				$result = @sqlite_query($query, $this->db_connect_id); -				while ($void = @sqlite_fetch_array($result, SQLITE_ASSOC)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +					while ($void = sqlite_fetch_array($result, SQLITE_ASSOC)) +					{ +						// Take the time spent on parsing rows into account +					}  				}  				$splittime = explode(' ', microtime()); diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php index 4e3e0d3329..f5c2dd225b 100644 --- a/phpBB/phpbb/db/driver/sqlite3.php +++ b/phpBB/phpbb/db/driver/sqlite3.php @@ -147,6 +147,11 @@ class sqlite3 extends \phpbb\db\driver\driver  					$this->sql_time += microtime(true) - $this->curtime;  				} +				if (!$this->query_result) +				{ +					return false; +				} +  				if ($cache && $cache_ttl)  				{  					$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); @@ -388,9 +393,12 @@ class sqlite3 extends \phpbb\db\driver\driver  				$endtime = $endtime[0] + $endtime[1];  				$result = $this->dbo->query($query); -				while ($void = $result->fetchArray(SQLITE3_ASSOC)) +				if ($result)  				{ -					// Take the time spent on parsing rows into account +						while ($void = $result->fetchArray(SQLITE3_ASSOC)) +						{ +							// Take the time spent on parsing rows into account +						}  				}  				$splittime = explode(' ', microtime()); diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index f7021875f3..84b10e79c1 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -89,7 +89,7 @@ class md_exporter  	{  		$this->crawl_eventsmd($md_file, 'styles'); -		$styles = array('prosilver', 'subsilver2'); +		$styles = array('prosilver');  		foreach ($styles as $style)  		{  			$file_list = $this->get_recursive_file_list( @@ -179,7 +179,7 @@ class md_exporter  		{  			$wiki_page = '= Template Events =' . "\n";  			$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; -			$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Subsilver Placement (If applicable) !! Added in Release !! Explanation' . "\n"; +			$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Added in Release !! Explanation' . "\n";  		}  		foreach ($this->events as $event_name => $event) @@ -193,7 +193,7 @@ class md_exporter  			}  			else  			{ -				$wiki_page .= implode(', ', $event['files']['prosilver']) . ' || ' . implode(', ', $event['files']['subsilver2']); +				$wiki_page .= implode(', ', $event['files']['prosilver']);  			}  			$wiki_page .= " || {$event['since']} || " . str_replace("\n", ' ', $event['description']) . "\n"; @@ -246,7 +246,6 @@ class md_exporter  	{  		$files_list = array(  			'prosilver'		=> array(), -			'subsilver2'	=> array(),  			'adm'			=> array(),  		); @@ -266,10 +265,6 @@ class md_exporter  				{  					$files_list['prosilver'][] = substr($file, strlen('styles/prosilver/template/'));  				} -				else if (($this->filter !== 'adm') && strpos($file, 'styles/subsilver2/template/') === 0) -				{ -					$files_list['subsilver2'][] = substr($file, strlen('styles/subsilver2/template/')); -				}  				else if (($this->filter === 'adm') && strpos($file, 'adm/style/') === 0)  				{  					$files_list['adm'][] = substr($file, strlen('adm/style/')); diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 48b0f077c7..34947b176d 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -848,7 +848,7 @@ class fulltext_native extends \phpbb\search\base  			$sql_calc = $this->db->sql_build_query('SELECT', $sql_array_copy);  			unset($sql_array_copy); -			$this->db->sql_query($sql_calc); +			$result = $this->db->sql_query($sql_calc);  			$this->db->sql_freeresult($result);  			$sql_count = 'SELECT FOUND_ROWS() as total_results'; diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index 476ffd935e..0ba7a265e4 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -21,6 +21,9 @@ class environment extends \Twig_Environment  	/** @var \phpbb\path_helper */  	protected $phpbb_path_helper; +	/** @var \Symfony\Component\DependencyInjection\ContainerInterface */ +	protected $container; +  	/** @var \phpbb\extension\manager */  	protected $extension_manager; @@ -38,24 +41,49 @@ class environment extends \Twig_Environment  	*  	* @param \phpbb\config\config $phpbb_config The phpBB configuration  	* @param \phpbb\path_helper $path_helper phpBB path helper +	* @param \Symfony\Component\DependencyInjection\ContainerInterface $container The dependency injection container +	* @param string $cache_path The path to the cache directory  	* @param \phpbb\extension\manager $extension_manager phpBB extension manager  	* @param \Twig_LoaderInterface $loader Twig loader interface  	* @param array $options Array of options to pass to Twig  	*/ -	public function __construct($phpbb_config, \phpbb\path_helper $path_helper, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array()) +	public function __construct($phpbb_config, \phpbb\path_helper $path_helper, \Symfony\Component\DependencyInjection\ContainerInterface $container, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array())  	{  		$this->phpbb_config = $phpbb_config;  		$this->phpbb_path_helper = $path_helper;  		$this->extension_manager = $extension_manager; +		$this->container = $container;  		$this->phpbb_root_path = $this->phpbb_path_helper->get_phpbb_root_path();  		$this->web_root_path = $this->phpbb_path_helper->get_web_root_path(); +		$options = array_merge(array( +			'cache'			=> (defined('IN_INSTALL')) ? false : $cache_path, +			'debug'			=> defined('DEBUG'), +			'auto_reload'	=> (bool) $this->phpbb_config['load_tplcompile'], +			'autoescape'	=> false, +		), $options); +  		return parent::__construct($loader, $options);  	}  	/** +	* {@inheritdoc} +	*/ +	public function getLexer() +	{ +		if (null === $this->lexer) +		{ +			$this->lexer = $this->container->get('template.twig.lexer'); +			$this->lexer->set_environment($this); +		} + +		return $this->lexer; +	} + + +	/**  	* Get the list of enabled phpBB extensions  	*  	* Used in EVENT node diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index c5dc7273ba..a7848738bb 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -15,6 +15,11 @@ namespace phpbb\template\twig;  class lexer extends \Twig_Lexer  { +	public function set_environment(\Twig_Environment $env) +	{ +		$this->env = $env; +	} +  	public function tokenize($code, $filename = null)  	{  		// Our phpBB tags diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index a3b002f350..2a8fb76b90 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -78,9 +78,12 @@ class twig extends \phpbb\template\base  	* @param \phpbb\config\config $config  	* @param \phpbb\user $user  	* @param \phpbb\template\context $context template context +	* @param \phpbb\template\twig\environment $twig_environment +	* @param string $cache_path +	* @param array|\ArrayAccess $extensions  	* @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked  	*/ -	public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) +	public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\template\twig\environment $twig_environment, $cache_path, $extensions = array(), \phpbb\extension\manager $extension_manager = null)  	{  		$this->path_helper = $path_helper;  		$this->phpbb_root_path = $path_helper->get_phpbb_root_path(); @@ -89,35 +92,13 @@ class twig extends \phpbb\template\base  		$this->user = $user;  		$this->context = $context;  		$this->extension_manager = $extension_manager; +		$this->cachepath = $cache_path; +		$this->twig = $twig_environment; -		$this->cachepath = $this->phpbb_root_path . 'cache/twig/'; - -		// Initiate the loader, __main__ namespace paths will be setup later in set_style_names() -		$loader = new \phpbb\template\twig\loader(''); - -		$this->twig = new \phpbb\template\twig\environment( -			$this->config, -			$this->path_helper, -			$this->extension_manager, -			$loader, -			array( -				'cache'			=> (defined('IN_INSTALL')) ? false : $this->cachepath, -				'debug'			=> defined('DEBUG'), -				'auto_reload'	=> (bool) $this->config['load_tplcompile'], -				'autoescape'	=> false, -			) -		); - -		$this->twig->addExtension( -			new \phpbb\template\twig\extension( -				$this->context, -				$this->user -			) -		); - -		$lexer = new \phpbb\template\twig\lexer($this->twig); - -		$this->twig->setLexer($lexer); +		foreach ($extensions as $extension) +		{ +			$this->twig->addExtension($extension); +		}  		// Add admin namespace  		if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) | 
