summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-12-14 12:05:05 +0100
committerAndrey Andreev <narf@devilix.net>2016-12-14 12:05:05 +0100
commit867e8b56f752116fe1feae6c6db19020100458e3 (patch)
tree0b25fcb5cb6f2b9580db61dbe4e76e7ba6255536
parent56d1efc5b14d7bd5a92800ba9394bf9201d48b61 (diff)
parent25aab832ff5b064166b5af4f5c4269407c56b338 (diff)
Merge branch '3.1-stable' into develop
-rw-r--r--application/config/config.php22
-rw-r--r--system/core/CodeIgniter.php5
-rw-r--r--system/database/DB_query_builder.php29
-rw-r--r--system/database/drivers/pdo/pdo_driver.php46
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php41
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php8
-rw-r--r--system/database/drivers/postgre/postgre_driver.php8
-rw-r--r--system/libraries/Image_lib.php29
-rw-r--r--user_guide_src/source/changelog.rst6
-rw-r--r--user_guide_src/source/installation/upgrade_313.rst14
10 files changed, 78 insertions, 130 deletions
diff --git a/application/config/config.php b/application/config/config.php
index 0a7b8202b..c088e80c0 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -172,9 +172,6 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
-| By default CodeIgniter enables access to the $_GET array. If for some
-| reason you would like to disable it, set 'allow_get_array' to FALSE.
-|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
@@ -189,7 +186,6 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| use segment based URLs.
|
*/
-$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
@@ -197,6 +193,20 @@ $config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
+| Allow $_GET array
+|--------------------------------------------------------------------------
+|
+| By default CodeIgniter enables access to the $_GET array. If for some
+| reason you would like to disable it, set 'allow_get_array' to FALSE.
+|
+| WARNING: This feature is DEPRECATED and currently available only
+| for backwards compatibility purposes!
+|
+*/
+$config['allow_get_array'] = TRUE;
+
+/*
+|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
@@ -408,8 +418,8 @@ $config['cookie_httponly'] = FALSE;
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
-| This is particularly useful for portability between UNIX-based OSes,
-| (usually \n) and Windows (\r\n).
+| WARNING: This feature is DEPRECATED and currently available only
+| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 66ed9ec8f..97cac90ad 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -67,7 +67,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}
- require_once(APPPATH.'config/constants.php');
+ if (file_exists(APPPATH.'config/constants.php'))
+ {
+ require_once(APPPATH.'config/constants.php');
+ }
/*
* ------------------------------------------------------
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 5a86ce50f..b88ec956a 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -150,6 +150,13 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
protected $qb_set = array();
/**
+ * QB data set for update_batch()
+ *
+ * @var array
+ */
+ protected $qb_set_ub = array();
+
+ /**
* QB aliased tables list
*
* @var array
@@ -1886,7 +1893,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
if ($set === NULL)
{
- if (empty($this->qb_set))
+ if (empty($this->qb_set_ub))
{
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
}
@@ -1913,9 +1920,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
// Batch this baby
$affected_rows = 0;
- for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
+ for ($i = 0, $total = count($this->qb_set_ub); $i < $total; $i += $batch_size)
{
- if ($this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, $batch_size), $index)))
+ if ($this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set_ub, $i, $batch_size), $index)))
{
$affected_rows += $this->affected_rows();
}
@@ -1941,18 +1948,16 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
protected function _update_batch($table, $values, $index)
{
- $index_escaped = $this->protect_identifiers($index);
-
$ids = array();
foreach ($values as $key => $val)
{
- $ids[] = $val[$index];
+ $ids[] = $val[$index]['value'];
foreach (array_keys($val) as $field)
{
if ($field !== $index)
{
- $final[$field][] = 'WHEN '.$index_escaped.' = '.$val[$index].' THEN '.$val[$field];
+ $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['field'].' = '.$val[$index]['value'].' THEN '.$val[$field]['value'];
}
}
}
@@ -1965,7 +1970,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
.'ELSE '.$k.' END, ';
}
- $this->where($index_escaped.' IN('.implode(',', $ids).')', NULL, FALSE);
+ $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE);
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
}
@@ -2002,7 +2007,10 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$index_set = TRUE;
}
- $clean[$this->protect_identifiers($k2, FALSE, $escape)] = ($escape === FALSE) ? $v2 : $this->escape($v2);
+ $clean[$k2] = array(
+ 'field' => $this->protect_identifiers($k2, FALSE, $escape),
+ 'value' => ($escape === FALSE ? $v2 : $this->escape($v2))
+ );
}
if ($index_set === FALSE)
@@ -2010,7 +2018,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
return $this->display_error('db_batch_missing_index');
}
- $this->qb_set[] = $clean;
+ $this->qb_set_ub[] = $clean;
}
return $this;
@@ -2777,6 +2785,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
{
$this->_reset_run(array(
'qb_set' => array(),
+ 'qb_set_ub' => array(),
'qb_from' => array(),
'qb_join' => array(),
'qb_where' => array(),
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index c27607e55..2da9cf38f 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -311,52 +311,6 @@ class CI_DB_pdo_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k.' = CASE '."\n";
-
- foreach ($v as $row)
- {
- $cases .= $row."\n";
- }
-
- $cases .= 'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* Truncate statement
*
* Generates a platform-specific truncate string from the supplied data
diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
index 837779804..4eb7f0ba6 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
@@ -171,47 +171,6 @@ class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END), ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* Truncate statement
*
* Generates a platform-specific truncate string from the supplied data
diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
index 9483d2457..05b8350d1 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
@@ -326,13 +326,13 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
$ids = array();
foreach ($values as $key => $val)
{
- $ids[] = $val[$index];
+ $ids[] = $val[$index]['value'];
foreach (array_keys($val) as $field)
{
if ($field !== $index)
{
- $final[$field][] = 'WHEN '.$val[$index].' THEN '.$val[$field];
+ $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['value'].' THEN '.$val[$field]['value'];
}
}
}
@@ -340,12 +340,12 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
$cases = '';
foreach ($final as $k => $v)
{
- $cases .= $k.' = (CASE '.$index."\n"
+ $cases .= $k.' = (CASE '.$val[$index]['field']."\n"
.implode("\n", $v)."\n"
.'ELSE '.$k.' END), ';
}
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
+ $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE);
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
}
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index c7c827ea4..5cc6a421c 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -544,13 +544,13 @@ class CI_DB_postgre_driver extends CI_DB {
$ids = array();
foreach ($values as $key => $val)
{
- $ids[] = $val[$index];
+ $ids[] = $val[$index]['value'];
foreach (array_keys($val) as $field)
{
if ($field !== $index)
{
- $final[$field][] = 'WHEN '.$val[$index].' THEN '.$val[$field];
+ $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['value'].' THEN '.$val[$field]['value'];
}
}
}
@@ -558,12 +558,12 @@ class CI_DB_postgre_driver extends CI_DB {
$cases = '';
foreach ($final as $k => $v)
{
- $cases .= $k.' = (CASE '.$index."\n"
+ $cases .= $k.' = (CASE '.$val[$index]['field']."\n"
.implode("\n", $v)."\n"
.'ELSE '.$k.' END), ';
}
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
+ $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE);
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
}
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 06cdde0b8..475649c46 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -544,37 +544,30 @@ class CI_Image_lib {
*/
if ($this->new_image === '')
{
- $this->dest_image = $this->source_image;
+ $this->dest_image = $this->source_image;
$this->dest_folder = $this->source_folder;
}
- elseif (strpos($this->new_image, '/') === FALSE)
+ elseif (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
{
+ $this->dest_image = $this->new_image;
$this->dest_folder = $this->source_folder;
- $this->dest_image = $this->new_image;
}
else
{
- if (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
- {
- $full_dest_path = str_replace('\\', '/', realpath($this->new_image));
- }
- else
- {
- $full_dest_path = $this->new_image;
- }
-
// Is there a file name?
- if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $full_dest_path))
+ if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $this->new_image))
{
- $this->dest_folder = $full_dest_path.'/';
- $this->dest_image = $this->source_image;
+ $this->dest_image = $this->source_image;
+ $this->dest_folder = $this->new_image;
}
else
{
- $x = explode('/', $full_dest_path);
- $this->dest_image = end($x);
- $this->dest_folder = str_replace($this->dest_image, '', $full_dest_path);
+ $x = explode('/', str_replace('\\', '/', $this->new_image));
+ $this->dest_image = end($x);
+ $this->dest_folder = str_replace($this->dest_image, '', $this->new_image);
}
+
+ $this->dest_folder = realpath($this->dest_folder).'/';
}
/* Compile the finalized filenames/paths
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 6a0b827ae..6adb5073a 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -73,6 +73,8 @@ Release Date: Not Released
- General Changes
+ - Deprecated ``$config['allow_get_array']``.
+ - Deprecated ``$config['standardize_newlines']``.
- Deprecated :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()`.
Bug fixes for 3.1.3
@@ -89,6 +91,10 @@ Bug fixes for 3.1.3
- Fixed a bug (#4923) - :doc:`Session Library <libraries/sessions>` could execute an erroneous SQL query with the 'database' driver, if the lock attempt times out.
- Fixed a bug (#4927) - :doc:`Output Library <libraries/output>` method ``get_header()`` returned the first matching header, regardless of whether it would be replaced by a second ``set_header()`` call.
- Fixed a bug (#4844) - :doc:`Email Library <libraries/email>` didn't apply ``escapeshellarg()`` to the while passing the Sendmail ``-f`` parameter through ``popen()``.
+- Fixed a bug (#4928) - the bootstrap file didn't check if *config/constants.php* exists before trying to load it.
+- Fixed a bug (#4937) - :doc:`Image Manipulation Library <libraries/image_lib>` method ``initialize()`` didn't translate *new_image* inputs to absolute paths.
+- Fixed a bug (#4941) - :doc:`Query Builder <database/query_builder>` method ``order_by()`` didn't work with 'RANDOM' under the 'pdo/sqlite' driver.
+- Fixed a regression (#4892) - :doc:`Query Builder <database/query_builder>` method ``update_batch()`` didn't properly handle identifier escaping.
Version 3.1.2
=============
diff --git a/user_guide_src/source/installation/upgrade_313.rst b/user_guide_src/source/installation/upgrade_313.rst
index ebce7ab9b..76dd159e6 100644
--- a/user_guide_src/source/installation/upgrade_313.rst
+++ b/user_guide_src/source/installation/upgrade_313.rst
@@ -30,3 +30,17 @@ CodeIgniter 3.2+.
.. note:: The function is still available, but you're strongly encouraged
to remove its usage sooner rather than later.
+
+Step 3: Remove usage of $config['standardize_newlines']
+=======================================================
+
+The :doc:`Input Library <../libraries/input>` would optionally replace
+occurences of `\r\n`, `\r`, `\n` in input data with whatever the ``PHP_EOL``
+value is on your system - if you've set ``$config['standardize_newlines']``
+to ``TRUE`` in your *application/config/config.php*.
+
+This functionality is now deprecated and scheduled for removal in
+CodeIgniter 3.2.+.
+
+.. note:: The functionality is still available, but you're strongly
+ encouraged to remove its usage sooner rather than later.