diff options
author | Andrey Andreev <narf@devilix.net> | 2019-01-08 16:55:37 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2019-01-08 16:55:37 +0100 |
commit | 7ec458b45316b9f270e1e03de498244f71c605ea (patch) | |
tree | a110bf9c71b49a69beec49d1874f423375cd0fd1 /system | |
parent | 67563c64025085e61598a83fef3e25bef38b32c4 (diff) | |
parent | 12ee9843877bf80159d1d89a0e3a4f170e902725 (diff) |
Merge branch '3.1-stable' into develop
Conflicts resolved:
system/database/drivers/sqlite/sqlite_driver.php
system/database/drivers/sqlite/sqlite_forge.php
system/database/drivers/sqlite/sqlite_result.php
system/database/drivers/sqlite/sqlite_utility.php
system/helpers/captcha_helper.php
system/helpers/email_helper.php
system/helpers/inflector_helper.php
system/helpers/smiley_helper.php
system/language/english/form_validation_lang.php
system/libraries/Cart.php
system/libraries/Form_validation.php
system/libraries/Javascript.php
system/libraries/Javascript/Jquery.php
system/libraries/Session/SessionHandlerInterface.php
tests/codeigniter/helpers/inflector_helper_test.php
user_guide_src/source/helpers/inflector_helper.rst
Diffstat (limited to 'system')
-rw-r--r-- | system/database/DB_driver.php | 14 | ||||
-rw-r--r-- | system/database/DB_forge.php | 7 | ||||
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 34 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php | 5 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php | 2 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php | 12 | ||||
-rw-r--r-- | system/database/drivers/postgre/postgre_forge.php | 2 | ||||
-rw-r--r-- | system/database/drivers/sqlite3/sqlite3_driver.php | 12 | ||||
-rw-r--r-- | system/helpers/inflector_helper.php | 11 | ||||
-rw-r--r-- | system/language/english/form_validation_lang.php | 1 | ||||
-rw-r--r-- | system/libraries/Session/Session_driver.php | 4 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_database_driver.php | 2 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_files_driver.php | 6 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_memcached_driver.php | 2 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_redis_driver.php | 2 | ||||
-rw-r--r-- | system/libraries/Xmlrpc.php | 2 |
16 files changed, 62 insertions, 56 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index b6ab71784..b4f16b905 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -142,7 +142,7 @@ abstract class CI_DB_driver { * * @var int */ - public $port = ''; + public $port = NULL; /** * Persistent connection flag @@ -1246,19 +1246,13 @@ abstract class CI_DB_driver { */ public function list_fields($table) { - // Is there a cached result? - if (isset($this->data_cache['field_names'][$table])) - { - return $this->data_cache['field_names'][$table]; - } - if (FALSE === ($sql = $this->_list_columns($table))) { return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; } $query = $this->query($sql); - $this->data_cache['field_names'][$table] = array(); + $fields = array(); foreach ($query->result_array() as $row) { @@ -1280,10 +1274,10 @@ abstract class CI_DB_driver { } } - $this->data_cache['field_names'][$table][] = $row[$key]; + $fields[] = $row[$key]; } - return $this->data_cache['field_names'][$table]; + return $fields; } // -------------------------------------------------------------------- diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index dfc8a41b6..b086f7a81 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -348,7 +348,10 @@ abstract class CI_DB_forge { if (($result = $this->db->query($sql)) !== FALSE) { - isset($this->db->data_cache['table_names']) && $this->db->data_cache['table_names'][] = $table; + if (isset($this->db->data_cache['table_names'])) + { + $this->db->data_cache['table_names'][] = $table; + } // Most databases don't support creating indexes from within the CREATE TABLE statement if ( ! empty($this->keys)) @@ -724,7 +727,7 @@ abstract class CI_DB_forge { 'type' => isset($attributes['TYPE']) ? $attributes['TYPE'] : NULL, 'length' => '', 'unsigned' => '', - 'null' => '', + 'null' => NULL, 'unique' => '', 'default' => '', 'auto_increment' => '', diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index f67b52507..4f0c28e78 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -167,26 +167,28 @@ class CI_DB_mysqli_driver extends CI_DB { empty($this->encrypt['ssl_capath']) OR $ssl['capath'] = $this->encrypt['ssl_capath']; empty($this->encrypt['ssl_cipher']) OR $ssl['cipher'] = $this->encrypt['ssl_cipher']; - if ( ! empty($ssl)) + if (isset($this->encrypt['ssl_verify'])) { - if (isset($this->encrypt['ssl_verify'])) + $client_flags |= MYSQLI_CLIENT_SSL; + + if ($this->encrypt['ssl_verify']) + { + defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE); + } + // Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT + // to FALSE didn't do anything, so PHP 5.6.16 introduced yet another + // constant ... + // + // https://secure.php.net/ChangeLog-5.php#5.6.16 + // https://bugs.php.net/bug.php?id=68344 + elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')) { - if ($this->encrypt['ssl_verify']) - { - defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE); - } - // Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT - // to FALSE didn't do anything, so PHP 5.6.16 introduced yet another - // constant ... - // - // https://secure.php.net/ChangeLog-5.php#5.6.16 - // https://bugs.php.net/bug.php?id=68344 - elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')) - { - $client_flags |= MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; - } + $client_flags |= MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; } + } + if ( ! empty($ssl)) + { $client_flags |= MYSQLI_CLIENT_SSL; $this->_mysqli->ssl_set( isset($ssl['key']) ? $ssl['key'] : NULL, diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php index 01ba15c1c..26bc30e14 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php @@ -167,6 +167,11 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver { empty($this->encrypt['ssl_capath']) OR $ssl[PDO::MYSQL_ATTR_SSL_CAPATH] = $this->encrypt['ssl_capath']; empty($this->encrypt['ssl_cipher']) OR $ssl[PDO::MYSQL_ATTR_SSL_CIPHER] = $this->encrypt['ssl_cipher']; + if (defined('PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT') && isset($this->encrypt['ssl_verify'])) + { + $ssl[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $this->encrypt['ssl_verify']; + } + // DO NOT use array_merge() here! // It re-indexes numeric keys and the PDO_MYSQL_ATTR_SSL_* constants are integers. empty($ssl) OR $this->options += $ssl; diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php index d7b751999..ff7a11075 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php @@ -136,7 +136,7 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge { if (isset($field[$i]['null'])) { $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL'); + .(trim($field[$i]['null']) === $this->_null ? ' DROP NOT NULL' : ' SET NOT NULL'); } if ( ! empty($field[$i]['new_name'])) diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php index 396d10e61..f55d9a6c7 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php @@ -128,24 +128,18 @@ class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver { */ public function list_fields($table) { - // Is there a cached result? - if (isset($this->data_cache['field_names'][$table])) - { - return $this->data_cache['field_names'][$table]; - } - if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) { return FALSE; } - $this->data_cache['field_names'][$table] = array(); + $fields = array(); foreach ($result->result_array() as $row) { - $this->data_cache['field_names'][$table][] = $row['name']; + $fields[] = $row['name']; } - return $this->data_cache['field_names'][$table]; + return $fields; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 418376ab4..353ddac99 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -131,7 +131,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { if (isset($field[$i]['null'])) { $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL'); + .(trim($field[$i]['null']) === $this->_null ? ' DROP NOT NULL' : ' SET NOT NULL'); } if ( ! empty($field[$i]['new_name'])) diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index 14d8349f4..5d057ba5a 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -230,24 +230,18 @@ class CI_DB_sqlite3_driver extends CI_DB { */ public function list_fields($table) { - // Is there a cached result? - if (isset($this->data_cache['field_names'][$table])) - { - return $this->data_cache['field_names'][$table]; - } - if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) { return FALSE; } - $this->data_cache['field_names'][$table] = array(); + $fields = array(); foreach ($result->result_array() as $row) { - $this->data_cache['field_names'][$table][] = $row['name']; + $fields[] = $row['name']; } - return $this->data_cache['field_names'][$table]; + return $fields; } // -------------------------------------------------------------------- diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 04f2ac9d2..a36836b00 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -275,6 +275,17 @@ if ( ! function_exists('word_is_countable')) } } +// -------------------------------------------------------------------- + +if ( ! function_exists('is_countable')) +{ + function is_countable($word) + { + trigger_error('is_countable() is a native PHP function since version 7.3.0; use word_is_countable() instead', E_USER_WARNING); + return word_is_countable($word); + } +} + // ------------------------------------------------------------------------ if ( ! function_exists('ordinal_format')) diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index e7215a066..74a2512c4 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -44,6 +44,7 @@ $lang['form_validation_valid_emails'] = 'The {field} field must contain all val $lang['form_validation_valid_url'] = 'The {field} field must contain a valid URL.'; $lang['form_validation_valid_ip'] = 'The {field} field must contain a valid IP.'; $lang['form_validation_valid_mac'] = 'The {field} field must contain a valid MAC.'; +$lang['form_validation_valid_base64'] = 'The {field} field must contain a valid Base64 string.'; $lang['form_validation_min_length'] = 'The {field} field must be at least {param} characters in length.'; $lang['form_validation_max_length'] = 'The {field} field cannot exceed {param} characters in length.'; $lang['form_validation_exact_length'] = 'The {field} field must be exactly {param} characters in length.'; diff --git a/system/libraries/Session/Session_driver.php b/system/libraries/Session/Session_driver.php index ed0f0cd82..14ebdb09f 100644 --- a/system/libraries/Session/Session_driver.php +++ b/system/libraries/Session/Session_driver.php @@ -115,13 +115,13 @@ abstract class CI_Session_driver implements SessionHandlerInterface { /** * PHP 5.x validate ID * - * Enforces session.use_strict_mode on PHP 5.x (7+ does it by itself) + * Enforces session.use_strict_mode * * @return void */ public function php5_validate_id() { - if (PHP_VERSION_ID < 70000 && isset($_COOKIE[$this->_config['cookie_name']]) && ! $this->validateId($_COOKIE[$this->_config['cookie_name']])) + if (isset($_COOKIE[$this->_config['cookie_name']]) && ! $this->validateSessionId($_COOKIE[$this->_config['cookie_name']])) { unset($_COOKIE[$this->_config['cookie_name']]); } diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php index c626093f9..734fe624f 100644 --- a/system/libraries/Session/drivers/Session_database_driver.php +++ b/system/libraries/Session/drivers/Session_database_driver.php @@ -353,7 +353,7 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan * @param string $id * @return bool */ - public function validateId($id) + public function validateSessionId($id) { // Prevent previous QB calls from messing with our queries $this->_db->reset_query(); diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php index a2d25cc8f..467059434 100644 --- a/system/libraries/Session/drivers/Session_files_driver.php +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -402,9 +402,11 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * @param string $id * @return bool */ - public function validateId($id) + public function validateSessionId($id) { - return is_file($this->_file_path.$id); + $result = is_file($this->_file_path.$id); + clearstatcache(TRUE, $this->_file_path.$id); + return $result; } // -------------------------------------------------------------------- diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php index 7e026ad52..ab54f029f 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -303,7 +303,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa * @param string $id * @return bool */ - public function validateId($id) + public function validateSessionId($id) { $this->_memcached->get($this->_key_prefix.$id); return ($this->_memcached->getResultCode() === Memcached::RES_SUCCESS); diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index 6020a9ef9..07511e555 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -347,7 +347,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle * @param string $id * @return bool */ - public function validateId($id) + public function validateSessionId($id) { return (bool) $this->_redis->exists($this->_key_prefix.$id); } diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index ffe0813f7..4e8c303c7 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1211,7 +1211,7 @@ class XML_RPC_Message extends CI_Xmlrpc { echo '<pre>'; - if (count($this->xh[$pname]['headers'] > 0)) + if (count($this->xh[$pname]['headers']) > 0) { echo "---HEADERS---\n"; foreach ($this->xh[$pname]['headers'] as $header) |