Skip to content

Commit

Permalink
Merge branch '3.1-stable' into develop
Browse files Browse the repository at this point in the history
Conflicts resolved:
	.travis.yml
	system/core/CodeIgniter.php
	system/database/drivers/oci8/oci8_forge.php
	system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
	system/helpers/path_helper.php
	system/libraries/Email.php
	user_guide_src/source/changelog.rst
	user_guide_src/source/conf.py
	user_guide_src/source/contributing/index.rst
	user_guide_src/source/general/requirements.rst
	user_guide_src/source/general/styleguide.rst
	user_guide_src/source/installation/downloads.rst
	user_guide_src/source/installation/upgrade_310.rst
	user_guide_src/source/installation/upgrading.rst
  • Loading branch information
narfbg committed Jul 26, 2016
2 parents a9874a6 + 0b95402 commit 77266bc
Show file tree
Hide file tree
Showing 58 changed files with 669 additions and 428 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ env:
sudo: false

before_script:
<<<<<<< HEAD
- sh -c "composer install --dev --no-progress"
=======
>>>>>>> 3.1-stable
- sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ] || [ '$DB' = 'mysqli' ] || [ '$DB' = 'pdo/mysql' ]; then mysql -e 'create database IF NOT EXISTS ci_test;'; fi"
Expand All @@ -41,4 +44,5 @@ branches:
only:
- develop
- 3.0-stable
- 3.1-stable
- /^feature\/.+$/
2 changes: 1 addition & 1 deletion readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Server Requirements

PHP version 5.6 or newer is recommended.

It should work on 5.2.4 as well, but we strongly advise you NOT to run
It should work on 5.3.7 as well, but we strongly advise you NOT to run
such old versions of PHP, because of potential security and performance
issues, as well as missing features.

Expand Down
2 changes: 1 addition & 1 deletion system/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* @var string
*
*/
define('CI_VERSION', '3.1.0-dev');
define('CI_VERSION', '3.2.0-dev');

/*
* ------------------------------------------------------
Expand Down
9 changes: 3 additions & 6 deletions system/core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function base_url($uri = '', $protocol = NULL)
}
}

return $base_url.ltrim($this->_uri_string($uri), '/');
return $base_url.$this->_uri_string($uri);
}

// -------------------------------------------------------------
Expand All @@ -337,11 +337,8 @@ protected function _uri_string($uri)
{
if ($this->item('enable_query_strings') === FALSE)
{
if (is_array($uri))
{
$uri = implode('/', $uri);
}
return trim($uri, '/');
is_array($uri) && $uri = implode('/', $uri);
return ltrim($uri, '/');
}
elseif (is_array($uri))
{
Expand Down
30 changes: 16 additions & 14 deletions system/core/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ public function ip_address()
if ($separator === ':')
{
$netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
for ($i = 0; $i < 8; $i++)
for ($j = 0; $j < 8; $j++)
{
$netaddr[$i] = intval($netaddr[$i], 16);
$netaddr[$i] = intval($netaddr[$j], 16);
}
}
else
Expand Down Expand Up @@ -760,30 +760,32 @@ public function request_headers($xss_clean = FALSE)
// If header is already defined, return it immediately
if ( ! empty($this->headers))
{
return $this->headers;
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
}

// In Apache, you can simply call apache_request_headers()
if (function_exists('apache_request_headers'))
{
return $this->headers = apache_request_headers();
$this->headers = apache_request_headers();
}

$this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE');

foreach ($_SERVER as $key => $val)
else
{
if (sscanf($key, 'HTTP_%s', $header) === 1)
isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];

foreach ($_SERVER as $key => $val)
{
// take SOME_HEADER and turn it into Some-Header
$header = str_replace('_', ' ', strtolower($header));
$header = str_replace(' ', '-', ucwords($header));
if (sscanf($key, 'HTTP_%s', $header) === 1)
{
// take SOME_HEADER and turn it into Some-Header
$header = str_replace('_', ' ', strtolower($header));
$header = str_replace(' ', '-', ucwords($header));

$this->headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean);
$this->headers[$header] = $_SERVER[$key];
}
}
}

return $this->headers;
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
}

// --------------------------------------------------------------------
Expand Down
26 changes: 22 additions & 4 deletions system/core/compat/password.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,21 @@ function password_hash($password, $algo, array $options = array())
}
elseif ( ! isset($options['salt']))
{
if (defined('MCRYPT_DEV_URANDOM'))
if (function_exists('random_bytes'))
{
$options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
try
{
$options['salt'] = random_bytes(16);
}
catch (Exception $e)
{
log_message('error', 'compat/password: Error while trying to use random_bytes(): '.$e->getMessage());
return FALSE;
}
}
elseif (function_exists('openssl_random_pseudo_bytes'))
elseif (defined('MCRYPT_DEV_URANDOM'))
{
$options['salt'] = openssl_random_pseudo_bytes(16);
$options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
}
elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom')))
{
Expand All @@ -148,6 +156,16 @@ function password_hash($password, $algo, array $options = array())

fclose($fp);
}
elseif (function_exists('openssl_random_pseudo_bytes'))
{
$is_secure = NULL;
$options['salt'] = openssl_random_pseudo_bytes(16, $is_secure);
if ($is_secure !== TRUE)
{
log_message('error', 'compat/password: openssl_random_pseudo_bytes() set the $cryto_strong flag to FALSE');
return FALSE;
}
}
else
{
log_message('error', 'compat/password: No CSPRNG available.');
Expand Down
15 changes: 10 additions & 5 deletions system/database/DB_query_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ public function count_all_results($table = '', $reset = TRUE)
$this->qb_orderby = NULL;
}

$result = ($this->qb_distinct === TRUE)
$result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby))
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));

Expand Down Expand Up @@ -1498,8 +1498,10 @@ public function insert_batch($table, $set = NULL, $escape = NULL, $batch_size =
$affected_rows = 0;
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
{
$this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, $batch_size)));
$affected_rows += $this->affected_rows();
if ($this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, $batch_size))))
{
$affected_rows += $this->affected_rows();
}
}

$this->_reset_write();
Expand Down Expand Up @@ -1913,8 +1915,11 @@ public function update_batch($table, $set = NULL, $index = NULL, $batch_size = 1
$affected_rows = 0;
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
{
$this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, $batch_size), $this->protect_identifiers($index)));
$affected_rows += $this->affected_rows();
if ($this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, $batch_size), $this->protect_identifiers($index))))
{
$affected_rows += $this->affected_rows();
}

$this->qb_where = array();
}

Expand Down
3 changes: 3 additions & 0 deletions system/database/drivers/cubrid/cubrid_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ protected function _attr_type(&$attributes)
$attributes['TYPE'] = 'INTEGER';
$attributes['UNSIGNED'] = FALSE;
return;
case 'LONGTEXT':
$attributes['TYPE'] = 'STRING';
return;
default: return;
}
}
Expand Down
1 change: 1 addition & 0 deletions system/database/drivers/mssql/mssql_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public function db_select($database = '')
if (mssql_select_db('['.$database.']', $this->conn_id))
{
$this->database = $database;
$this->data_cache = array();
return TRUE;
}

Expand Down
5 changes: 5 additions & 0 deletions system/database/drivers/mssql/mssql_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ protected function _alter_table($alter_type, $table, $field)
*/
protected function _attr_type(&$attributes)
{
if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE)
{
unset($attributes['CONSTRAINT']);
}

switch (strtoupper($attributes['TYPE']))
{
case 'MEDIUMINT':
Expand Down
1 change: 1 addition & 0 deletions system/database/drivers/mysql/mysql_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public function db_select($database = '')
if (mysql_select_db($database, $this->conn_id))
{
$this->database = $database;
$this->data_cache = array();
return TRUE;
}

Expand Down
1 change: 1 addition & 0 deletions system/database/drivers/mysqli/mysqli_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public function db_select($database = '')
if ($this->conn_id->select_db($database))
{
$this->database = $database;
$this->data_cache = array();
return TRUE;
}

Expand Down
20 changes: 13 additions & 7 deletions system/database/drivers/oci8/oci8_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,23 +559,29 @@ public function field_data($table)
*/
public function error()
{
/* oci_error() returns an array that already contains the
* 'code' and 'message' keys, so we can just return it.
*/
// oci_error() returns an array that already contains
// 'code' and 'message' keys, but it can return false
// if there was no error ....
if (is_resource($this->curs_id))
{
return oci_error($this->curs_id);
$error = oci_error($this->curs_id);
}
elseif (is_resource($this->stmt_id))
{
return oci_error($this->stmt_id);
$error = oci_error($this->stmt_id);
}
elseif (is_resource($this->conn_id))
{
return oci_error($this->conn_id);
$error = oci_error($this->conn_id);
}
else
{
$error = oci_error();
}

return oci_error();
return is_array($error)
? $error
: array('code' => '', 'message' => '');
}

// --------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion system/database/drivers/oci8/oci8_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,4 @@ protected function _attr_type(&$attributes)
default: return;
}
}

}
Loading

0 comments on commit 77266bc

Please sign in to comment.