Skip to content

Instantly share code, notes, and snippets.

@kenjis
Created August 28, 2015 23:45
Show Gist options
  • Save kenjis/90523d05b451f03c5dc6 to your computer and use it in GitHub Desktop.
Save kenjis/90523d05b451f03c5dc6 to your computer and use it in GitHub Desktop.
diff -uwbrN CodeIgniter-3.0.0/.gitignore CodeIgniter-3.0.1/.gitignore
--- CodeIgniter-3.0.0/.gitignore 1970-01-01 09:00:00.000000000 +0900
+++ CodeIgniter-3.0.1/.gitignore 2015-08-07 20:31:33.000000000 +0900
@@ -0,0 +1,27 @@
+.DS_Store
+
+application/cache/*
+!application/cache/index.html
+!application/cache/.htaccess
+
+application/logs/*
+!application/logs/index.html
+!application/logs/.htaccess
+
+user_guide_src/build/*
+user_guide_src/cilexer/build/*
+user_guide_src/cilexer/dist/*
+user_guide_src/cilexer/pycilexer.egg-info/*
+/vendor/
+
+# IDE Files
+#-------------------------
+/nbproject/
+.idea/*
+
+## Sublime Text cache files
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+*.sublime-workspace
+*.sublime-project
diff -uwbrN CodeIgniter-3.0.0/application/config/autoload.php CodeIgniter-3.0.1/application/config/autoload.php
--- CodeIgniter-3.0.0/application/config/autoload.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/autoload.php 2015-08-07 20:31:33.000000000 +0900
@@ -39,16 +39,15 @@
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
-
$autoload['packages'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
-| These are the classes located in the system/libraries folder
-| or in your application/libraries folder.
+| These are the classes located in system/libraries/ or your
+| application/libraries/ directory, with the addition of the
+| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
@@ -59,26 +58,23 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
-
$autoload['libraries'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
-| These classes are located in the system/libraries folder or in your
-| application/libraries folder within their own subdirectory. They
+| These classes are located in system/libraries/ or in your
+| application/libraries/ directory, but are also placed inside their
+| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
*/
-
$autoload['drivers'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
@@ -87,10 +83,8 @@
|
| $autoload['helper'] = array('url', 'file');
*/
-
$autoload['helper'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Config files
@@ -103,10 +97,8 @@
| config files. Otherwise, leave it blank.
|
*/
-
$autoload['config'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Language files
@@ -119,10 +111,8 @@
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
-
$autoload['language'] = array();
-
/*
| -------------------------------------------------------------------
| Auto-load Models
@@ -136,5 +126,4 @@
|
| $autoload['model'] = array('first_model' => 'first');
*/
-
$autoload['model'] = array();
diff -uwbrN CodeIgniter-3.0.0/application/config/config.php CodeIgniter-3.0.1/application/config/config.php
--- CodeIgniter-3.0.0/application/config/config.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/config.php 2015-08-07 20:31:33.000000000 +0900
@@ -58,7 +58,6 @@
|
| http://codeigniter.com/user_guide/general/urls.html
*/
-
$config['url_suffix'] = '';
/*
@@ -155,7 +154,6 @@
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
-
/*
|--------------------------------------------------------------------------
| Enable Query Strings
@@ -192,8 +190,6 @@
| Error Logging Threshold
|--------------------------------------------------------------------------
|
-| If you have enabled error logging, you can set an error threshold to
-| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
@@ -288,8 +284,15 @@
| Cache Include Query String
|--------------------------------------------------------------------------
|
-| Set this to TRUE if you want to use different cache files depending on the
-| URL query string. Please be aware this might result in numerous cache files.
+| Whether to take the URL query string into consideration when generating
+| output cache files. Valid options are:
+|
+| FALSE = Disabled
+| TRUE = Enabled, take all query parameters into account.
+| Please be aware that this may result in numerous cache
+| files generated for the same page over and over again.
+| array('q') = Enabled, but only take into account the specified list
+| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
@@ -327,7 +330,7 @@
|
| 'sess_save_path'
|
-| The location to save sessions to, driver dependant.
+| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
@@ -390,7 +393,7 @@
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
-| meaning to replace \r\n, \r, \n occurences with the PHP_EOL value.
+| 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).
@@ -477,10 +480,11 @@
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
+| Note: You need to have eval() enabled for this to work.
+|
*/
$config['rewrite_short_tags'] = FALSE;
-
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
diff -uwbrN CodeIgniter-3.0.0/application/config/constants.php CodeIgniter-3.0.1/application/config/constants.php
--- CodeIgniter-3.0.0/application/config/constants.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/constants.php 2015-08-07 20:31:33.000000000 +0900
@@ -27,7 +27,6 @@
| These modes are used when working with fopen()/popen()
|
*/
-
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
diff -uwbrN CodeIgniter-3.0.0/application/config/database.php CodeIgniter-3.0.1/application/config/database.php
--- CodeIgniter-3.0.0/application/config/database.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/database.php 2015-08-07 20:31:33.000000000 +0900
@@ -40,9 +40,21 @@
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
+|
+| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
+| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
+|
+| 'ssl_key' - Path to the private key file
+| 'ssl_cert' - Path to the public key certificate file
+| 'ssl_ca' - Path to the certificate authority file
+| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
+| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
+| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
+|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
+| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
@@ -58,7 +70,6 @@
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
-
$active_group = 'default';
$query_builder = TRUE;
@@ -71,7 +82,7 @@
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
- 'db_debug' => TRUE,
+ 'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
diff -uwbrN CodeIgniter-3.0.0/application/config/foreign_chars.php CodeIgniter-3.0.1/application/config/foreign_chars.php
--- CodeIgniter-3.0.0/application/config/foreign_chars.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/foreign_chars.php 2015-08-07 20:31:33.000000000 +0900
@@ -56,6 +56,7 @@
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
+ '/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
diff -uwbrN CodeIgniter-3.0.0/application/config/migration.php CodeIgniter-3.0.1/application/config/migration.php
--- CodeIgniter-3.0.0/application/config/migration.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/migration.php 2015-08-07 20:31:33.000000000 +0900
@@ -21,12 +21,12 @@
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
-| 'sequential' = Default migration naming (001_add_blog.php)
+| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
-| If this configuration value is missing the Migration library defaults
-| to 'sequential' for backward compatibility.
+| Note: If this configuration value is missing the Migration library
+| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
diff -uwbrN CodeIgniter-3.0.0/application/config/mimes.php CodeIgniter-3.0.1/application/config/mimes.php
--- CodeIgniter-3.0.0/application/config/mimes.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/mimes.php 2015-08-07 20:31:33.000000000 +0900
@@ -9,7 +9,6 @@
| Upload class to help identify allowed file types.
|
*/
-
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
@@ -127,7 +126,7 @@
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
- '3gp' => 'video/3gp',
+ '3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => 'video/mp4',
@@ -152,5 +151,8 @@
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
- 'vcf' => 'text/x-vcard'
+ 'vcf' => 'text/x-vcard',
+ 'srt' => array('text/srt', 'text/plain'),
+ 'vtt' => array('text/vtt', 'text/plain'),
+ 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon')
);
diff -uwbrN CodeIgniter-3.0.0/application/config/smileys.php CodeIgniter-3.0.1/application/config/smileys.php
--- CodeIgniter-3.0.0/application/config/smileys.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/smileys.php 2015-08-07 20:31:33.000000000 +0900
@@ -13,7 +13,6 @@
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
-
$smileys = array(
// smiley image name width height alt
diff -uwbrN CodeIgniter-3.0.0/application/config/user_agents.php CodeIgniter-3.0.1/application/config/user_agents.php
--- CodeIgniter-3.0.0/application/config/user_agents.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/config/user_agents.php 2015-08-07 20:31:33.000000000 +0900
@@ -10,7 +10,6 @@
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
*/
-
$platforms = array(
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
@@ -62,6 +61,7 @@
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
+ 'Edge' => 'Spartan',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
diff -uwbrN CodeIgniter-3.0.0/application/views/errors/cli/error_exception.php CodeIgniter-3.0.1/application/views/errors/cli/error_exception.php
--- CodeIgniter-3.0.0/application/views/errors/cli/error_exception.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/views/errors/cli/error_exception.php 2015-08-07 20:31:33.000000000 +0900
@@ -1,12 +1,10 @@
-<?php
-defined('BASEPATH') OR exit('No direct script access allowed');
-?>
+<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
An uncaught Exception was encountered
-Type: <?php echo get_class($exception); ?>
-Message: <?php echo $message; ?>
-Filename: <?php echo $exception->getFile(); ?>
+Type: <?php echo get_class($exception), "\n"; ?>
+Message: <?php echo $message, "\n"; ?>
+Filename: <?php echo $exception->getFile(), "\n"; ?>
Line Number: <?php echo $exception->getLine(); ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
@@ -14,12 +12,10 @@
Backtrace:
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
-
- File: <?php echo $error['file']; ?>
- Line: <?php echo $error['line']; ?>
- Function: <?php echo $error['function']; ?>
-
+ File: <?php echo $error['file'], "\n"; ?>
+ Line: <?php echo $error['line'], "\n"; ?>
+ Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
-
<?php endforeach ?>
+
<?php endif ?>
\ No newline at end of file
diff -uwbrN CodeIgniter-3.0.0/application/views/errors/cli/error_php.php CodeIgniter-3.0.1/application/views/errors/cli/error_php.php
--- CodeIgniter-3.0.0/application/views/errors/cli/error_php.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/application/views/errors/cli/error_php.php 2015-08-07 20:31:33.000000000 +0900
@@ -1,12 +1,10 @@
-<?php
-defined('BASEPATH') OR exit('No direct script access allowed');
-?>
+<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
A PHP Error was encountered
-Severity: <?php echo $severity;?>
-Message: <?php echo $message;?>
-Filename: <?php echo $filepath;?>
+Severity: <?php echo $severity, "\n"; ?>
+Message: <?php echo $message, "\n"; ?>
+Filename: <?php echo $filepath, "\n"; ?>
Line Number: <?php echo $line;?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
@@ -14,12 +12,10 @@
Backtrace:
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
-
- File: <?php echo $error['file'];?>
- Line: <?php echo $error['line'];?>
- Function: <?php echo $error['function'];?>
-
+ File: <?php echo $error['file'], "\n"; ?>
+ Line: <?php echo $error['line'], "\n"; ?>
+ Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
-
<?php endforeach ?>
+
<?php endif ?>
\ No newline at end of file
diff -uwbrN CodeIgniter-3.0.0/composer.json CodeIgniter-3.0.1/composer.json
--- CodeIgniter-3.0.0/composer.json 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/composer.json 2015-08-07 20:31:33.000000000 +0900
@@ -1,7 +1,15 @@
{
"description" : "The CodeIgniter framework",
"name" : "codeigniter/framework",
+ "type": "project",
+ "homepage": "http://codeigniter.com",
"license": "MIT",
+ "support": {
+ "forum": "http://forum.codeigniter.com/",
+ "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
+ "irc": "irc://irc.freenode.net/codeigniter",
+ "source": "https://github.com/bcit-ci/CodeIgniter"
+ },
"require": {
"php": ">=5.2.4"
},
diff -uwbrN CodeIgniter-3.0.0/system/core/CodeIgniter.php CodeIgniter-3.0.1/system/core/CodeIgniter.php
--- CodeIgniter-3.0.0/system/core/CodeIgniter.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/CodeIgniter.php 2015-08-07 20:31:33.000000000 +0900
@@ -55,7 +55,7 @@
* @var string
*
*/
- define('CI_VERSION', '3.0.0');
+ define('CI_VERSION', '3.0.1');
/*
* ------------------------------------------------------
diff -uwbrN CodeIgniter-3.0.0/system/core/Common.php CodeIgniter-3.0.1/system/core/Common.php
--- CodeIgniter-3.0.0/system/core/Common.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Common.php 2015-08-07 20:31:33.000000000 +0900
@@ -181,7 +181,7 @@
// Did we find the class?
if ($name === FALSE)
{
- // Note: We use exit() rather then show_error() in order to avoid a
+ // Note: We use exit() rather than show_error() in order to avoid a
// self-referencing loop with the Exceptions class
set_status_header(503);
echo 'Unable to locate the specified class: '.$class.'.php';
@@ -506,6 +506,9 @@
{
is_int($code) OR $code = (int) $code;
$stati = array(
+ 100 => 'Continue',
+ 101 => 'Switching Protocols',
+
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
@@ -524,6 +527,7 @@
400 => 'Bad Request',
401 => 'Unauthorized',
+ 402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
@@ -829,19 +833,9 @@
{
if ( ! isset($_suhosin_func_blacklist))
{
- if (extension_loaded('suhosin'))
- {
- $_suhosin_func_blacklist = explode(',', trim(ini_get('suhosin.executor.func.blacklist')));
-
- if ( ! in_array('eval', $_suhosin_func_blacklist, TRUE) && ini_get('suhosin.executor.disable_eval'))
- {
- $_suhosin_func_blacklist[] = 'eval';
- }
- }
- else
- {
- $_suhosin_func_blacklist = array();
- }
+ $_suhosin_func_blacklist = extension_loaded('suhosin')
+ ? explode(',', trim(ini_get('suhosin.executor.func.blacklist')))
+ : array();
}
return ! in_array($function_name, $_suhosin_func_blacklist, TRUE);
diff -uwbrN CodeIgniter-3.0.0/system/core/Hooks.php CodeIgniter-3.0.1/system/core/Hooks.php
--- CodeIgniter-3.0.0/system/core/Hooks.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Hooks.php 2015-08-07 20:31:33.000000000 +0900
@@ -46,7 +46,7 @@
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link http://codeigniter.com/user_guide/libraries/encryption.html
+ * @link http://codeigniter.com/user_guide/general/hooks.html
*/
class CI_Hooks {
diff -uwbrN CodeIgniter-3.0.0/system/core/Input.php CodeIgniter-3.0.1/system/core/Input.php
--- CodeIgniter-3.0.0/system/core/Input.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Input.php 2015-08-07 20:31:33.000000000 +0900
@@ -799,19 +799,27 @@
*/
public function get_request_header($index, $xss_clean = FALSE)
{
- if (empty($this->headers))
+ static $headers;
+
+ if ( ! isset($headers))
+ {
+ empty($this->headers) OR $this->request_headers();
+ foreach ($this->headers as $key => $value)
{
- $this->request_headers();
+ $headers[strtolower($key)] = $value;
}
+ }
+
+ $index = strtolower($index);
- if ( ! isset($this->headers[$index]))
+ if ( ! isset($headers[$index]))
{
return NULL;
}
return ($xss_clean === TRUE)
- ? $this->security->xss_clean($this->headers[$index])
- : $this->headers[$index];
+ ? $this->security->xss_clean($headers[$index])
+ : $headers[$index];
}
// --------------------------------------------------------------------
diff -uwbrN CodeIgniter-3.0.0/system/core/Loader.php CodeIgniter-3.0.1/system/core/Loader.php
--- CodeIgniter-3.0.0/system/core/Loader.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Loader.php 2015-08-07 20:31:33.000000000 +0900
@@ -272,7 +272,7 @@
$CI =& get_instance();
if (isset($CI->$name))
{
- show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
+ throw new RuntimeException('The model name you are loading is the name of a resource that is already being used: '.$name);
}
if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE))
@@ -291,7 +291,8 @@
}
$model = ucfirst(strtolower($model));
-
+ if ( ! class_exists($model))
+ {
foreach ($this->_ci_model_paths as $mod_path)
{
if ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))
@@ -300,16 +301,29 @@
}
require_once($mod_path.'models/'.$path.$model.'.php');
+ if ( ! class_exists($model, FALSE))
+ {
+ throw new RuntimeException($mod_path."models/".$path.$model.".php exists, but doesn't declare class ".$model);
+ }
+
+ break;
+ }
+
+ if ( ! class_exists($model, FALSE))
+ {
+ throw new RuntimeException('Unable to locate the model you have specified: '.$model);
+ }
+ }
+ elseif ( ! is_subclass_of($model, 'CI_Model'))
+ {
+ throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model");
+ }
$this->_ci_models[] = $name;
$CI->$name = new $model();
return $this;
}
- // couldn't find the model
- show_error('Unable to locate the model you have specified: '.$model);
- }
-
// --------------------------------------------------------------------
/**
@@ -500,7 +514,7 @@
*
* Clears the cached variables.
*
- * @return object
+ * @return CI_Loader
*/
public function clear_vars()
{
@@ -905,7 +919,7 @@
// If the PHP installation does not support short tags we'll
// do a little string replacement, changing the short tags
// to standard PHP echo statements.
- if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE && function_usable('eval'))
+ if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE)
{
echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
}
@@ -1118,7 +1132,7 @@
}
else
{
- log_message('debug', APPPATH.'libraries/'.$file_path.$subclass.'.php exists, but does not declare '.$subclass);
+ log_message('debug', $path.' exists, but does not declare '.$subclass);
}
}
}
@@ -1307,10 +1321,7 @@
}
// Load all other libraries
- foreach ($autoload['libraries'] as $item)
- {
- $this->library($item);
- }
+ $this->library($autoload['libraries']);
}
// Autoload models
diff -uwbrN CodeIgniter-3.0.0/system/core/Output.php CodeIgniter-3.0.1/system/core/Output.php
--- CodeIgniter-3.0.0/system/core/Output.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Output.php 2015-08-07 20:31:33.000000000 +0900
@@ -556,10 +556,17 @@
.$CI->config->item('index_page')
.$CI->uri->uri_string();
- if ($CI->config->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
+ {
+ if (is_array($cache_query_string))
+ {
+ $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
+ }
+ else
{
$uri .= '?'.$_SERVER['QUERY_STRING'];
}
+ }
$cache_path .= md5($uri);
@@ -646,10 +653,17 @@
// Build the file path. The file name is an MD5 hash of the full URI
$uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string;
- if ($CFG->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ if (($cache_query_string = $CFG->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
+ {
+ if (is_array($cache_query_string))
+ {
+ $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
+ }
+ else
{
$uri .= '?'.$_SERVER['QUERY_STRING'];
}
+ }
$filepath = $cache_path.md5($uri);
@@ -674,7 +688,7 @@
$cache_info = unserialize($match[1]);
$expire = $cache_info['expire'];
- $last_modified = filemtime($cache_path);
+ $last_modified = filemtime($filepath);
// Has the file expired?
if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path))
@@ -729,13 +743,20 @@
{
$uri = $CI->uri->uri_string();
- if ($CI->config->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
+ {
+ if (is_array($cache_query_string))
+ {
+ $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
+ }
+ else
{
$uri .= '?'.$_SERVER['QUERY_STRING'];
}
}
+ }
- $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').$uri);
+ $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/'));
if ( ! @unlink($cache_path))
{
diff -uwbrN CodeIgniter-3.0.0/system/core/Router.php CodeIgniter-3.0.1/system/core/Router.php
--- CodeIgniter-3.0.0/system/core/Router.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Router.php 2015-08-07 20:31:33.000000000 +0900
@@ -83,7 +83,7 @@
*
* @var string
*/
- public $directory = '';
+ public $directory;
/**
* Default controller (and method if specific)
@@ -105,7 +105,7 @@
/**
* Enable query strings flag
*
- * Determines wether to use GET parameters or segment URIs
+ * Determines whether to use GET parameters or segment URIs
*
* @var bool
*/
@@ -126,25 +126,16 @@
$this->uri =& load_class('URI', 'core');
$this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE);
+
+ // If a directory override is configured, it has to be set before any dynamic routing logic
+ is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
$this->_set_routing();
// Set any routing overrides that may exist in the main index file
if (is_array($routing))
{
- if (isset($routing['directory']))
- {
- $this->set_directory($routing['directory']);
- }
-
- if ( ! empty($routing['controller']))
- {
- $this->set_class($routing['controller']);
- }
-
- if ( ! empty($routing['function']))
- {
- $this->set_method($routing['function']);
- }
+ empty($routing['controller']) OR $this->set_class($routing['controller']);
+ empty($routing['function']) OR $this->set_method($routing['function']);
}
log_message('info', 'Router Class Initialized');
@@ -167,13 +158,18 @@
// If this feature is enabled, we will gather the directory/class/method a little differently
if ($this->enable_query_strings)
{
+ // If the directory is set at this time, it means an override exists, so skip the checks
+ if ( ! isset($this->directory))
+ {
$_d = $this->config->item('directory_trigger');
$_d = isset($_GET[$_d]) ? trim($_GET[$_d], " \t\n\r\0\x0B/") : '';
+
if ($_d !== '')
{
$this->uri->filter_uri($_d);
$this->set_directory($_d);
}
+ }
$_c = trim($this->config->item('controller_trigger'));
if ( ! empty($_GET[$_c]))
@@ -333,6 +329,8 @@
protected function _validate_request($segments)
{
$c = count($segments);
+ $directory_override = isset($this->directory);
+
// Loop through our segments and return as soon as a controller
// is found or when such a directory doesn't exist
while ($c-- > 0)
@@ -340,7 +338,10 @@
$test = $this->directory
.ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]);
- if ( ! file_exists(APPPATH.'controllers/'.$test.'.php') && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0]))
+ if ( ! file_exists(APPPATH.'controllers/'.$test.'.php')
+ && $directory_override === FALSE
+ && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0])
+ )
{
$this->set_directory(array_shift($segments), TRUE);
continue;
@@ -374,16 +375,19 @@
// Is there a literal match? If so we're done
if (isset($this->routes[$uri]))
{
- // Check default routes format
- if (is_string($this->routes[$uri]))
+ // Is it an HTTP verb-based route?
+ if (is_array($this->routes[$uri]))
{
- $this->_set_request(explode('/', $this->routes[$uri]));
+ $route = array_change_key_case($this->routes[$uri], CASE_LOWER);
+ if (isset($route[$http_verb]))
+ {
+ $this->_set_request(explode('/', $route[$http_verb]));
return;
}
- // Is there a matching http verb?
- elseif (is_array($this->routes[$uri]) && isset($this->routes[$uri][$http_verb]))
+ }
+ else
{
- $this->_set_request(explode('/', $this->routes[$uri][$http_verb]));
+ $this->_set_request(explode('/', $this->routes[$uri]));
return;
}
}
@@ -391,9 +395,10 @@
// Loop through the route array looking for wildcards
foreach ($this->routes as $key => $val)
{
- // Check if route format is using http verb
+ // Check if route format is using HTTP verbs
if (is_array($val))
{
+ $val = array_change_key_case($val, CASE_LOWER);
if (isset($val[$http_verb]))
{
$val = $val[$http_verb];
@@ -493,7 +498,7 @@
* Set directory name
*
* @param string $dir Directory name
- * @param bool $appent Whether we're appending rather then setting the full value
+ * @param bool $append Whether we're appending rather than setting the full value
* @return void
*/
public function set_directory($dir, $append = FALSE)
diff -uwbrN CodeIgniter-3.0.0/system/core/Security.php CodeIgniter-3.0.1/system/core/Security.php
--- CodeIgniter-3.0.0/system/core/Security.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/Security.php 2015-08-07 20:31:33.000000000 +0900
@@ -275,7 +275,7 @@
$secure_cookie,
config_item('cookie_httponly')
);
- log_message('info', 'CRSF cookie sent');
+ log_message('info', 'CSRF cookie sent');
return $this;
}
diff -uwbrN CodeIgniter-3.0.0/system/core/URI.php CodeIgniter-3.0.1/system/core/URI.php
--- CodeIgniter-3.0.0/system/core/URI.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/URI.php 2015-08-07 20:31:33.000000000 +0900
@@ -201,7 +201,9 @@
return '';
}
- $uri = parse_url($_SERVER['REQUEST_URI']);
+ // parse_url() returns false if no host is present, but the path or query string
+ // contains a colon followed by a number
+ $uri = parse_url('http://dummy'.$_SERVER['REQUEST_URI']);
$query = isset($uri['query']) ? $uri['query'] : '';
$uri = isset($uri['path']) ? $uri['path'] : '';
diff -uwbrN CodeIgniter-3.0.0/system/core/compat/hash.php CodeIgniter-3.0.1/system/core/compat/hash.php
--- CodeIgniter-3.0.0/system/core/compat/hash.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/core/compat/hash.php 2015-08-07 20:31:33.000000000 +0900
@@ -174,9 +174,56 @@
}
$hash_length = strlen(hash($algo, NULL, TRUE));
- if (empty($length))
+ empty($length) && $length = $hash_length;
+
+ // Pre-hash password inputs longer than the algorithm's block size
+ // (i.e. prepare HMAC key) to mitigate potential DoS attacks.
+ static $block_sizes;
+ empty($block_sizes) && $block_sizes = array(
+ 'gost' => 32,
+ 'haval128,3' => 128,
+ 'haval160,3' => 128,
+ 'haval192,3' => 128,
+ 'haval224,3' => 128,
+ 'haval256,3' => 128,
+ 'haval128,4' => 128,
+ 'haval160,4' => 128,
+ 'haval192,4' => 128,
+ 'haval224,4' => 128,
+ 'haval256,4' => 128,
+ 'haval128,5' => 128,
+ 'haval160,5' => 128,
+ 'haval192,5' => 128,
+ 'haval224,5' => 128,
+ 'haval256,5' => 128,
+ 'md2' => 16,
+ 'md4' => 64,
+ 'md5' => 64,
+ 'ripemd128' => 64,
+ 'ripemd160' => 64,
+ 'ripemd256' => 64,
+ 'ripemd320' => 64,
+ 'salsa10' => 64,
+ 'salsa20' => 64,
+ 'sha1' => 64,
+ 'sha224' => 64,
+ 'sha256' => 64,
+ 'sha384' => 128,
+ 'sha512' => 128,
+ 'snefru' => 32,
+ 'snefru256' => 32,
+ 'tiger128,3' => 64,
+ 'tiger160,3' => 64,
+ 'tiger192,3' => 64,
+ 'tiger128,4' => 64,
+ 'tiger160,4' => 64,
+ 'tiger192,4' => 64,
+ 'whirlpool' => 64
+ );
+
+ if (isset($block_sizes[$algo]) && strlen($password) > $block_sizes[$algo])
{
- $length = $hash_length;
+ $password = hash($algo, $password, TRUE);
}
$hash = '';
diff -uwbrN CodeIgniter-3.0.0/system/database/DB_driver.php CodeIgniter-3.0.1/system/database/DB_driver.php
--- CodeIgniter-3.0.0/system/database/DB_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/DB_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -647,7 +647,10 @@
}
// This will trigger a rollback if transactions are being used
+ if ($this->_trans_depth !== 0)
+ {
$this->_trans_status = FALSE;
+ }
// Grab the error now, as we might run some additional queries before displaying the error
$error = $this->error();
@@ -1218,7 +1221,7 @@
/**
* Fetch Field Names
*
- * @param string the table name
+ * @param string $table Table name
* @return array
*/
public function list_fields($table)
@@ -1751,7 +1754,7 @@
//
// Added exception for single quotes as well, we don't want to alter
// literal strings. -- Narf
- if (strpos($item, '(') !== FALSE OR strpos($item, "'") !== FALSE)
+ if (strcspn($item, "()'") !== strlen($item))
{
return $item;
}
diff -uwbrN CodeIgniter-3.0.0/system/database/DB_forge.php CodeIgniter-3.0.1/system/database/DB_forge.php
--- CodeIgniter-3.0.0/system/database/DB_forge.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/DB_forge.php 2015-08-07 20:31:33.000000000 +0900
@@ -143,7 +143,7 @@
protected $_unsigned = TRUE;
/**
- * NULL value representatin in CREATE/ALTER TABLE statements
+ * NULL value representation in CREATE/ALTER TABLE statements
*
* @var string
*/
@@ -239,7 +239,7 @@
*/
public function add_key($key, $primary = FALSE)
{
- if ($primary === TRUE && is_array($key))
+ if (is_array($key))
{
foreach ($key as $one)
{
@@ -453,12 +453,7 @@
return ($this->db->db_debug) ? $this->db->display_error('db_table_name_required') : FALSE;
}
- $query = $this->_drop_table($this->db->dbprefix.$table_name, $if_exists);
- if ($query === FALSE)
- {
- return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE;
- }
- elseif ($query === TRUE)
+ if (($query = $this->_drop_table($this->db->dbprefix.$table_name, $if_exists)) === TRUE)
{
return TRUE;
}
diff -uwbrN CodeIgniter-3.0.0/system/database/DB_query_builder.php CodeIgniter-3.0.1/system/database/DB_query_builder.php
--- CodeIgniter-3.0.0/system/database/DB_query_builder.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/DB_query_builder.php 2015-08-07 20:31:33.000000000 +0900
@@ -794,13 +794,23 @@
$not = ($not) ? ' NOT' : '';
+ if ($escape === TRUE)
+ {
$where_in = array();
foreach ($values as $value)
{
$where_in[] = $this->escape($value);
}
+ }
+ else
+ {
+ $where_in = array_values($values);
+ }
+
+ $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
+ ? $this->_group_get_type('')
+ : $this->_group_get_type($type);
- $prefix = (count($this->qb_where) === 0) ? $this->_group_get_type('') : $this->_group_get_type($type);
$where_in = array(
'condition' => $prefix.$key.$not.' IN('.implode(', ', $where_in).')',
'escape' => $escape
@@ -918,13 +928,18 @@
}
is_bool($escape) OR $escape = $this->_protect_identifiers;
+ // lowercase $side in case somebody writes e.g. 'BEFORE' instead of 'before' (doh)
+ $side = strtolower($side);
foreach ($field as $k => $v)
{
$prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
? $this->_group_get_type('') : $this->_group_get_type($type);
+ if ($escape === TRUE)
+ {
$v = $this->escape_like_str($v);
+ }
if ($side === 'none')
{
@@ -944,7 +959,7 @@
}
// some platforms require an escape sequence definition for LIKE wildcards
- if ($this->_like_escape_str !== '')
+ if ($escape === TRUE && $this->_like_escape_str !== '')
{
$like_statement .= sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
@@ -1292,7 +1307,7 @@
* Compiles a SELECT query string and returns the sql.
*
* @param string the table name to select from (optional)
- * @param bool TRUE: resets QB values; FALSE: leave QB vaules alone
+ * @param bool TRUE: resets QB values; FALSE: leave QB values alone
* @return string
*/
public function get_compiled_select($table = '', $reset = TRUE)
@@ -1734,7 +1749,7 @@
return FALSE;
}
- $sql = $this->_update($this->protect_identifiers($this->qb_from[0], TRUE, NULL, FALSE), $this->qb_set);
+ $sql = $this->_update($this->qb_from[0], $this->qb_set);
if ($reset === TRUE)
{
@@ -1782,7 +1797,7 @@
$this->limit($limit);
}
- $sql = $this->_update($this->protect_identifiers($this->qb_from[0], TRUE, NULL, FALSE), $this->qb_set);
+ $sql = $this->_update($this->qb_from[0], $this->qb_set);
$this->_reset_write();
return $this->query($sql);
}
@@ -1799,7 +1814,7 @@
* @param string the table to update data on
* @return bool
*/
- protected function _validate_update($table = '')
+ protected function _validate_update($table)
{
if (count($this->qb_set) === 0)
{
@@ -1808,7 +1823,7 @@
if ($table !== '')
{
- $this->qb_from[0] = $table;
+ $this->qb_from = array($this->protect_identifiers($table, TRUE, NULL, FALSE));
}
elseif ( ! isset($this->qb_from[0]))
{
@@ -2090,10 +2105,13 @@
}
elseif (is_array($table))
{
+ empty($where) && $reset_data = FALSE;
+
foreach ($table as $single_table)
{
$this->delete($single_table, $where, $limit, $reset_data);
}
+
return;
}
else
@@ -2253,7 +2271,7 @@
else
{
// Cycle through the "select" portion of the query and prep each column name.
- // The reason we protect identifiers here rather then in the select() function
+ // The reason we protect identifiers here rather than in the select() function
// is because until the user calls the from() function we don't know if there are aliases
foreach ($this->qb_select as $key => $val)
{
@@ -2324,7 +2342,7 @@
// Split multiple conditions
$conditions = preg_split(
- '/(\s*AND\s+|\s*OR\s+)/i',
+ '/((^|\s+)AND\s+|(^|\s+)OR\s+)/i',
$this->{$qb_key}[$i]['condition'],
-1,
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
diff -uwbrN CodeIgniter-3.0.0/system/database/DB_utility.php CodeIgniter-3.0.1/system/database/DB_utility.php
--- CodeIgniter-3.0.0/system/database/DB_utility.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/DB_utility.php 2015-08-07 20:31:33.000000000 +0900
@@ -249,7 +249,7 @@
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
}
- $out = substr(rtrim($out), 0, -strlen($delim)).$newline;
+ $out = substr($out, 0, -strlen($delim)).$newline;
// Next blast through the result array and build out the rows
while ($row = $query->unbuffered_row('array'))
@@ -258,7 +258,7 @@
{
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
}
- $out = substr(rtrim($out), 0, -strlen($delim)).$newline;
+ $out = substr($out, 0, -strlen($delim)).$newline;
}
return $out;
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/mysqli/mysqli_driver.php CodeIgniter-3.0.1/system/database/drivers/mysqli/mysqli_driver.php
--- CodeIgniter-3.0.0/system/database/drivers/mysqli/mysqli_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/mysqli/mysqli_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -102,7 +102,6 @@
*
* @param bool $persistent
* @return object
- * @todo SSL support
*/
public function db_connect($persistent = FALSE)
{
@@ -132,8 +131,52 @@
$mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode="STRICT_ALL_TABLES"');
}
- return $mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags)
- ? $mysqli : FALSE;
+ if (is_array($this->encrypt))
+ {
+ $ssl = array();
+ empty($this->encrypt['ssl_key']) OR $ssl['key'] = $this->encrypt['ssl_key'];
+ empty($this->encrypt['ssl_cert']) OR $ssl['cert'] = $this->encrypt['ssl_cert'];
+ empty($this->encrypt['ssl_ca']) OR $ssl['ca'] = $this->encrypt['ssl_ca'];
+ 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 ( ! empty($this->encrypt['ssl_verify']) && defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'))
+ {
+ $mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE);
+ }
+
+ $client_flags |= MYSQLI_CLIENT_SSL;
+ $mysqli->ssl_set(
+ isset($ssl['key']) ? $ssl['key'] : NULL,
+ isset($ssl['cert']) ? $ssl['cert'] : NULL,
+ isset($ssl['ca']) ? $ssl['ca'] : NULL,
+ isset($ssl['capath']) ? $ssl['capath'] : NULL,
+ isset($ssl['cipher']) ? $ssl['cipher'] : NULL
+ );
+ }
+ }
+
+ if ($mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags))
+ {
+ // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
+ if (
+ ($client_flags & MYSQLI_CLIENT_SSL)
+ && version_compare($mysqli->client_info, '5.7.3', '<=')
+ && empty($mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_object()->Value)
+ )
+ {
+ $mysqli->close();
+ $message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!';
+ log_message('error', $message);
+ return ($this->db->db_debug) ? $this->db->display_error($message, '', TRUE) : FALSE;
+ }
+
+ return $mysqli;
+ }
+
+ return FALSE;
}
// --------------------------------------------------------------------
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/oci8/oci8_driver.php CodeIgniter-3.0.1/system/database/drivers/oci8/oci8_driver.php
--- CodeIgniter-3.0.0/system/database/drivers/oci8/oci8_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/oci8/oci8_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -102,6 +102,14 @@
// --------------------------------------------------------------------
/**
+ * Reset $stmt_id flag
+ *
+ * Used by stored_procedure() to prevent _execute() from
+ * re-setting the statement ID.
+ */
+ protected $_reset_stmt_id = TRUE;
+
+ /**
* List of reserved identifiers
*
* Identifiers that must NOT be escaped.
@@ -265,26 +273,13 @@
/* Oracle must parse the query before it is run. All of the actions with
* the query are based on the statement id returned by oci_parse().
*/
- $this->stmt_id = FALSE;
- $this->_set_stmt_id($sql);
- oci_set_prefetch($this->stmt_id, 1000);
- return oci_execute($this->stmt_id, $this->commit_mode);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Generate a statement ID
- *
- * @param string $sql an SQL query
- * @return void
- */
- protected function _set_stmt_id($sql)
- {
- if ( ! is_resource($this->stmt_id))
+ if ($this->_reset_stmt_id === TRUE)
{
$this->stmt_id = oci_parse($this->conn_id, $sql);
}
+
+ oci_set_prefetch($this->stmt_id, 1000);
+ return oci_execute($this->stmt_id, $this->commit_mode);
}
// --------------------------------------------------------------------
@@ -318,15 +313,15 @@
* type yes the type of the parameter
* length yes the max size of the parameter
*/
- public function stored_procedure($package, $procedure, $params)
+ public function stored_procedure($package, $procedure, array $params)
{
- if ($package === '' OR $procedure === '' OR ! is_array($params))
+ if ($package === '' OR $procedure === '')
{
log_message('error', 'Invalid query: '.$package.'.'.$procedure);
return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE;
}
- // build the query string
+ // Build the query string
$sql = 'BEGIN '.$package.'.'.$procedure.'(';
$have_cursor = FALSE;
@@ -341,10 +336,12 @@
}
$sql = trim($sql, ',').'); END;';
- $this->stmt_id = FALSE;
- $this->_set_stmt_id($sql);
+ $this->_reset_stmt_id = FALSE;
+ $this->stmt_id = oci_parse($this->conn_id, $sql);
$this->_bind_params($params);
- return $this->query($sql, FALSE, $have_cursor);
+ $result = $this->query($sql, FALSE, $have_cursor);
+ $this->_reset_stmt_id = TRUE;
+ return $result;
}
// --------------------------------------------------------------------
@@ -573,7 +570,7 @@
{
$default = '';
}
- $retval[$i]->default = $query[$i]->COLUMN_DEFAULT;
+ $retval[$i]->default = $default;
}
return $retval;
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php CodeIgniter-3.0.1/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
--- CodeIgniter-3.0.0/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -119,7 +119,6 @@
*
* @param bool $persistent
* @return object
- * @todo SSL support
*/
public function db_connect($persistent = FALSE)
{
@@ -151,7 +150,59 @@
$this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
}
- return parent::db_connect($persistent);
+ // SSL support was added to PDO_MYSQL in PHP 5.3.7
+ if (is_array($this->encrypt) && is_php('5.3.7'))
+ {
+ $ssl = array();
+ empty($this->encrypt['ssl_key']) OR $ssl[PDO::MYSQL_ATTR_SSL_KEY] = $this->encrypt['ssl_key'];
+ empty($this->encrypt['ssl_cert']) OR $ssl[PDO::MYSQL_ATTR_SSL_CERT] = $this->encrypt['ssl_cert'];
+ empty($this->encrypt['ssl_ca']) OR $ssl[PDO::MYSQL_ATTR_SSL_CA] = $this->encrypt['ssl_ca'];
+ 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'];
+
+ // 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;
+ }
+
+ // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
+ if (
+ ($pdo = parent::db_connect($persistent)) !== FALSE
+ && ! empty($ssl)
+ && version_compare($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION), '5.7.3', '<=')
+ && empty($pdo->query("SHOW STATUS LIKE 'ssl_cipher'")->fetchObject()->Value)
+ )
+ {
+ $message = 'PDO_MYSQL was configured for an SSL connection, but got an unencrypted connection instead!';
+ log_message('error', $message);
+ return ($this->db->db_debug) ? $this->db->display_error($message, '', TRUE) : FALSE;
+ }
+
+ return $pdo;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Select the database
+ *
+ * @param string $database
+ * @return bool
+ */
+ public function db_select($database = '')
+ {
+ if ($database === '')
+ {
+ $database = $this->database;
+ }
+
+ if (FALSE !== $this->simple_query('USE '.$this->escape_identifiers($database)))
+ {
+ $this->database = $database;
+ return TRUE;
+ }
+
+ return FALSE;
}
// --------------------------------------------------------------------
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php CodeIgniter-3.0.1/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
--- CodeIgniter-3.0.0/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -121,19 +121,33 @@
// --------------------------------------------------------------------
/**
- * Show column query
+ * Fetch Field Names
*
- * Generates a platform-specific query string so that the column names can be fetched
- *
- * @param string $table
- * @return string
+ * @param string $table Table name
+ * @return array
*/
- protected function _list_columns($table = '')
+ 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)
{
- // Not supported
return FALSE;
}
+ $this->data_cache['field_names'][$table] = array();
+ foreach ($result->result_array() as $row)
+ {
+ $this->data_cache['field_names'][$table][] = $row['name'];
+ }
+
+ return $this->data_cache['field_names'][$table];
+ }
+
// --------------------------------------------------------------------
/**
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php CodeIgniter-3.0.1/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php
--- CodeIgniter-3.0.0/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php 2015-08-07 20:31:33.000000000 +0900
@@ -89,6 +89,7 @@
if (version_compare($this->db->version(), '3.3', '<'))
{
$this->_create_table_if = FALSE;
+ $this->_drop_table_if = FALSE;
}
}
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/sqlite3/sqlite3_driver.php CodeIgniter-3.0.1/system/database/drivers/sqlite3/sqlite3_driver.php
--- CodeIgniter-3.0.0/system/database/drivers/sqlite3/sqlite3_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/sqlite3/sqlite3_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -247,19 +247,33 @@
// --------------------------------------------------------------------
/**
- * Show column query
+ * Fetch Field Names
*
- * Generates a platform-specific query string so that the column names can be fetched
- *
- * @param string $table
- * @return string
+ * @param string $table Table name
+ * @return array
*/
- protected function _list_columns($table = '')
+ 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)
{
- // Not supported
return FALSE;
}
+ $this->data_cache['field_names'][$table] = array();
+ foreach ($result->result_array() as $row)
+ {
+ $this->data_cache['field_names'][$table][] = $row['name'];
+ }
+
+ return $this->data_cache['field_names'][$table];
+ }
+
// --------------------------------------------------------------------
/**
diff -uwbrN CodeIgniter-3.0.0/system/database/drivers/sqlite3/sqlite3_forge.php CodeIgniter-3.0.1/system/database/drivers/sqlite3/sqlite3_forge.php
--- CodeIgniter-3.0.0/system/database/drivers/sqlite3/sqlite3_forge.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/database/drivers/sqlite3/sqlite3_forge.php 2015-08-07 20:31:33.000000000 +0900
@@ -74,7 +74,8 @@
if (version_compare($this->db->version(), '3.3', '<'))
{
- $this->create_table_if = FALSE;
+ $this->_create_table_if = FALSE;
+ $this->_drop_table_if = FALSE;
}
}
diff -uwbrN CodeIgniter-3.0.0/system/helpers/array_helper.php CodeIgniter-3.0.1/system/helpers/array_helper.php
--- CodeIgniter-3.0.0/system/helpers/array_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/array_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -62,7 +62,7 @@
* @param mixed
* @return mixed depends on what the array contains
*/
- function element($item, $array, $default = NULL)
+ function element($item, array $array, $default = NULL)
{
return array_key_exists($item, $array) ? $array[$item] : $default;
}
@@ -99,7 +99,7 @@
* @param mixed
* @return mixed depends on what the array contains
*/
- function elements($items, $array, $default = NULL)
+ function elements($items, array $array, $default = NULL)
{
$return = array();
diff -uwbrN CodeIgniter-3.0.0/system/helpers/download_helper.php CodeIgniter-3.0.1/system/helpers/download_helper.php
--- CodeIgniter-3.0.0/system/helpers/download_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/download_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -69,19 +69,17 @@
}
elseif ($data === NULL)
{
- if (@is_file($filename) && ($filesize = @filesize($filename)) !== FALSE)
+ if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE)
{
+ return;
+ }
+
$filepath = $filename;
$filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename));
$filename = end($filename);
}
else
{
- return;
- }
- }
- else
- {
$filesize = strlen($data);
}
@@ -140,14 +138,7 @@
header('Expires: 0');
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.$filesize);
-
- // Internet Explorer-specific headers
- if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
- {
- header('Cache-Control: no-cache, no-store, must-revalidate');
- }
-
- header('Pragma: no-cache');
+ header('Cache-Control: private, no-transform, no-store, must-revalidate');
// If we have raw data - just dump it
if ($data !== NULL)
diff -uwbrN CodeIgniter-3.0.0/system/helpers/file_helper.php CodeIgniter-3.0.1/system/helpers/file_helper.php
--- CodeIgniter-3.0.0/system/helpers/file_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/file_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -54,7 +54,7 @@
/**
* Read File
*
- * Opens the file specfied in the path and returns it as a string.
+ * Opens the file specified in the path and returns it as a string.
*
* @todo Remove in version 3.1+.
* @deprecated 3.0.0 It is now just an alias for PHP's native file_get_contents().
diff -uwbrN CodeIgniter-3.0.0/system/helpers/form_helper.php CodeIgniter-3.0.1/system/helpers/form_helper.php
--- CodeIgniter-3.0.0/system/helpers/form_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/form_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -197,7 +197,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_input($data = '', $value = '', $extra = '')
@@ -208,7 +208,7 @@
'value' => $value
);
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -223,7 +223,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_password($data = '', $value = '', $extra = '')
@@ -245,7 +245,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_upload($data = '', $value = '', $extra = '')
@@ -253,7 +253,8 @@
$defaults = array('type' => 'file', 'name' => '');
is_array($data) OR $data = array('name' => $data);
$data['type'] = 'file';
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -266,7 +267,7 @@
*
* @param mixed $data
* @param string $value
- * @param string $extra
+ * @param mixed $extra
* @return string
*/
function form_textarea($data = '', $value = '', $extra = '')
@@ -287,7 +288,9 @@
unset($data['value']); // textareas don't use the value attribute
}
- return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.html_escape($val)."</textarea>\n";
+ return '<textarea '._parse_form_attributes($data, $defaults)._attributes_to_string($extra).'>'
+ .html_escape($val)
+ ."</textarea>\n";
}
}
@@ -301,12 +304,13 @@
* @param string
* @param array
* @param mixed
- * @param string
+ * @param mixed
* @return string
*/
function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '')
{
- if ( ! strpos($extra, 'multiple'))
+ $extra = _attributes_to_string($extra);
+ if (stripos($extra, 'multiple') === FALSE)
{
$extra .= ' multiple="multiple"';
}
@@ -372,7 +376,7 @@
$extra = _attributes_to_string($extra);
- $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
+ $multiple = (count($selected) > 1 && stripos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
$form = '<select '.rtrim(_parse_form_attributes($data, $defaults)).$extra.$multiple.">\n";
@@ -420,7 +424,7 @@
* @param mixed
* @param string
* @param bool
- * @param string
+ * @param mixed
* @return string
*/
function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
@@ -450,7 +454,7 @@
unset($defaults['checked']);
}
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -464,13 +468,14 @@
* @param mixed
* @param string
* @param bool
- * @param string
+ * @param mixed
* @return string
*/
function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
{
is_array($data) OR $data = array('name' => $data);
$data['type'] = 'radio';
+
return form_checkbox($data, $value, $checked, $extra);
}
}
@@ -484,7 +489,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_submit($data = '', $value = '', $extra = '')
@@ -495,7 +500,7 @@
'value' => $value
);
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -508,7 +513,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_reset($data = '', $value = '', $extra = '')
@@ -519,7 +524,7 @@
'value' => $value
);
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -532,7 +537,7 @@
*
* @param mixed
* @param string
- * @param string
+ * @param mixed
* @return string
*/
function form_button($data = '', $content = '', $extra = '')
@@ -548,7 +553,9 @@
unset($data['content']); // content is not an attribute
}
- return '<button '._parse_form_attributes($data, $defaults).$extra.'>'.$content."</button>\n";
+ return '<button '._parse_form_attributes($data, $defaults)._attributes_to_string($extra).'>'
+ .$content
+ ."</button>\n";
}
}
diff -uwbrN CodeIgniter-3.0.0/system/helpers/inflector_helper.php CodeIgniter-3.0.1/system/helpers/inflector_helper.php
--- CodeIgniter-3.0.0/system/helpers/inflector_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/inflector_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -133,6 +133,7 @@
}
$plural_rules = array(
+ '/(quiz)$/' => '\1zes', // quizzes
'/^(ox)$/' => '\1\2en', // ox
'/([m|l])ouse$/' => '\1ice', // mouse, louse
'/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index
diff -uwbrN CodeIgniter-3.0.0/system/helpers/path_helper.php CodeIgniter-3.0.1/system/helpers/path_helper.php
--- CodeIgniter-3.0.0/system/helpers/path_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/path_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -61,7 +61,7 @@
function set_realpath($path, $check_existance = FALSE)
{
// Security check to make sure the path is NOT a URL. No remote file inclusion!
- if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i', $path))
+ if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp)#i', $path) OR filter_var($path, FILTER_VALIDATE_IP) === $path )
{
show_error('The path you submitted must be a local server path, not a URL');
}
diff -uwbrN CodeIgniter-3.0.0/system/helpers/string_helper.php CodeIgniter-3.0.1/system/helpers/string_helper.php
--- CodeIgniter-3.0.0/system/helpers/string_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/string_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -253,7 +253,7 @@
*/
function increment_string($str, $separator = '_', $first = 1)
{
- preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
+ preg_match('/(.+)'.preg_quote($separator, '/').'([0-9]+)$/', $str, $match);
return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
}
}
diff -uwbrN CodeIgniter-3.0.0/system/helpers/text_helper.php CodeIgniter-3.0.1/system/helpers/text_helper.php
--- CodeIgniter-3.0.0/system/helpers/text_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/text_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -254,7 +254,7 @@
* word you've submitted.
*
* @param string the text string
- * @param string the array of censoered words
+ * @param string the array of censored words
* @param string the optional replacement value
* @return string
*/
diff -uwbrN CodeIgniter-3.0.0/system/helpers/url_helper.php CodeIgniter-3.0.1/system/helpers/url_helper.php
--- CodeIgniter-3.0.0/system/helpers/url_helper.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/helpers/url_helper.php 2015-08-07 20:31:33.000000000 +0900
@@ -161,7 +161,7 @@
$site_url = is_array($uri)
? site_url($uri)
- : preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri);
+ : (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri));
if ($title === '')
{
@@ -474,7 +474,7 @@
* @param string $str Input string
* @param string $separator Word separator
* (usually '-' or '_')
- * @param bool $lowercase Wether to transform the output string to lowercase
+ * @param bool $lowercase Whether to transform the output string to lowercase
* @return string
*/
function url_title($str, $separator = '-', $lowercase = FALSE)
@@ -492,7 +492,7 @@
$trans = array(
'&.+?;' => '',
- '[^a-z0-9 _-]' => '',
+ '[^\w\d _-]' => '',
'\s+' => $separator,
'('.$q_separator.')+' => $separator
);
@@ -500,7 +500,7 @@
$str = strip_tags($str);
foreach ($trans as $key => $val)
{
- $str = preg_replace('#'.$key.'#i', $val, $str);
+ $str = preg_replace('#'.$key.'#i'.(UTF8_ENABLED ? 'u' : ''), $val, $str);
}
if ($lowercase === TRUE)
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Cache/Cache.php CodeIgniter-3.0.1/system/libraries/Cache/Cache.php
--- CodeIgniter-3.0.0/system/libraries/Cache/Cache.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Cache/Cache.php 2015-08-07 20:31:33.000000000 +0900
@@ -100,28 +100,10 @@
*/
public function __construct($config = array())
{
- $default_config = array(
- 'adapter',
- 'memcached'
- );
-
- foreach ($default_config as $key)
- {
- if (isset($config[$key]))
- {
- $param = '_'.$key;
-
- $this->{$param} = $config[$key];
- }
- }
-
+ isset($config['adapter']) && $this->_adapter = $config['adapter'];
+ isset($config['backup']) && $this->_backup_driver = $config['backup'];
isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix'];
- if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers))
- {
- $this->_backup_driver = $config['backup'];
- }
-
// If the specified adapter isn't available, check the backup.
if ( ! $this->is_supported($this->_adapter))
{
@@ -196,7 +178,7 @@
*/
public function increment($id, $offset = 1)
{
- return $this->{$this->_adapter}->increment($id, $offset);
+ return $this->{$this->_adapter}->increment($this->key_prefix.$id, $offset);
}
// ------------------------------------------------------------------------
@@ -210,7 +192,7 @@
*/
public function decrement($id, $offset = 1)
{
- return $this->{$this->_adapter}->decrement($id, $offset);
+ return $this->{$this->_adapter}->decrement($this->key_prefix.$id, $offset);
}
// ------------------------------------------------------------------------
@@ -261,14 +243,13 @@
*/
public function is_supported($driver)
{
- static $support = array();
+ static $support;
- if ( ! isset($support[$driver]))
+ if ( ! isset($support, $support[$driver]))
{
$support[$driver] = $this->{$driver}->is_supported();
}
return $support[$driver];
}
-
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Cache/drivers/Cache_memcached.php CodeIgniter-3.0.1/system/libraries/Cache/drivers/Cache_memcached.php
--- CodeIgniter-3.0.0/system/libraries/Cache/drivers/Cache_memcached.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Cache/drivers/Cache_memcached.php 2015-08-07 20:31:33.000000000 +0900
@@ -68,6 +68,76 @@
)
);
+ // ------------------------------------------------------------------------
+
+ /**
+ * Class constructor
+ *
+ * Setup Memcache(d)
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ // Try to load memcached server info from the config file.
+ $CI =& get_instance();
+ $defaults = $this->_memcache_conf['default'];
+
+ if ($CI->config->load('memcached', TRUE, TRUE))
+ {
+ if (is_array($CI->config->config['memcached']))
+ {
+ $this->_memcache_conf = array();
+
+ foreach ($CI->config->config['memcached'] as $name => $conf)
+ {
+ $this->_memcache_conf[$name] = $conf;
+ }
+ }
+ }
+
+ if (class_exists('Memcached', FALSE))
+ {
+ $this->_memcached = new Memcached();
+ }
+ elseif (class_exists('Memcache', FALSE))
+ {
+ $this->_memcached = new Memcache();
+ }
+ else
+ {
+ throw new RuntimeException('Cache: Failed to create Memcache(d) object; extension not loaded?');
+ }
+
+ foreach ($this->_memcache_conf as $cache_server)
+ {
+ isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host'];
+ isset($cache_server['port']) OR $cache_server['port'] = $defaults['port'];
+ isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight'];
+
+ if (get_class($this->_memcached) === 'Memcache')
+ {
+ // Third parameter is persistance and defaults to TRUE.
+ $this->_memcached->addServer(
+ $cache_server['hostname'],
+ $cache_server['port'],
+ TRUE,
+ $cache_server['weight']
+ );
+ }
+ else
+ {
+ $this->_memcached->addServer(
+ $cache_server['hostname'],
+ $cache_server['port'],
+ $cache_server['weight']
+ );
+ }
+ }
+ }
+
+ // ------------------------------------------------------------------------
+
/**
* Fetch from cache
*
@@ -205,75 +275,6 @@
// ------------------------------------------------------------------------
/**
- * Setup memcached.
- *
- * @return bool
- */
- protected function _setup_memcached()
- {
- // Try to load memcached server info from the config file.
- $CI =& get_instance();
- $defaults = $this->_memcache_conf['default'];
-
- if ($CI->config->load('memcached', TRUE, TRUE))
- {
- if (is_array($CI->config->config['memcached']))
- {
- $this->_memcache_conf = array();
-
- foreach ($CI->config->config['memcached'] as $name => $conf)
- {
- $this->_memcache_conf[$name] = $conf;
- }
- }
- }
-
- if (class_exists('Memcached', FALSE))
- {
- $this->_memcached = new Memcached();
- }
- elseif (class_exists('Memcache', FALSE))
- {
- $this->_memcached = new Memcache();
- }
- else
- {
- log_message('error', 'Failed to create object for Memcached Cache; extension not loaded?');
- return FALSE;
- }
-
- foreach ($this->_memcache_conf as $cache_server)
- {
- isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host'];
- isset($cache_server['port']) OR $cache_server['port'] = $defaults['port'];
- isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight'];
-
- if (get_class($this->_memcached) === 'Memcache')
- {
- // Third parameter is persistance and defaults to TRUE.
- $this->_memcached->addServer(
- $cache_server['hostname'],
- $cache_server['port'],
- TRUE,
- $cache_server['weight']
- );
- }
- else
- {
- $this->_memcached->addServer(
- $cache_server['hostname'],
- $cache_server['port'],
- $cache_server['weight']
- );
- }
- }
-
- return TRUE;
- }
-
- // ------------------------------------------------------------------------
-
- /**
* Is supported
*
* Returns FALSE if memcached is not supported on the system.
@@ -289,7 +290,6 @@
return FALSE;
}
- return $this->_setup_memcached();
+ return TRUE;
}
-
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Cache/drivers/Cache_redis.php CodeIgniter-3.0.1/system/libraries/Cache/drivers/Cache_redis.php
--- CodeIgniter-3.0.0/system/libraries/Cache/drivers/Cache_redis.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Cache/drivers/Cache_redis.php 2015-08-07 20:31:33.000000000 +0900
@@ -79,6 +79,63 @@
// ------------------------------------------------------------------------
/**
+ * Class constructor
+ *
+ * Setup Redis
+ *
+ * Loads Redis config file if present. Will halt execution
+ * if a Redis connection can't be established.
+ *
+ * @return void
+ * @see Redis::connect()
+ */
+ public function __construct()
+ {
+ $config = array();
+ $CI =& get_instance();
+
+ if ($CI->config->load('redis', TRUE, TRUE))
+ {
+ $config = $CI->config->item('redis');
+ }
+
+ $config = array_merge(self::$_default_config, $config);
+ $this->_redis = new Redis();
+
+ try
+ {
+ if ($config['socket_type'] === 'unix')
+ {
+ $success = $this->_redis->connect($config['socket']);
+ }
+ else // tcp socket
+ {
+ $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']);
+ }
+
+ if ( ! $success)
+ {
+ throw new RuntimeException('Cache: Redis connection failed. Check your configuration.');
+ }
+ }
+ catch (RedisException $e)
+ {
+ throw new RuntimeException('Cache: Redis connection refused ('.$e->getMessage().')');
+ }
+
+ if (isset($config['password']) && ! $this->_redis->auth($config['password']))
+ {
+ throw new RuntimeException('Cache: Redis authentication failed.');
+ }
+
+ // Initialize the index of serialized values.
+ $serialized = $this->_redis->sMembers('_ci_redis_serialized');
+ empty($serialized) OR $this->_serialized = array_flip($serialized);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
* Get cache
*
* @param string Cache ID
@@ -125,9 +182,7 @@
$this->_redis->sRemove('_ci_redis_serialized', $id);
}
- return ($ttl)
- ? $this->_redis->setex($id, $ttl, $data)
- : $this->_redis->set($id, $data);
+ return $this->_redis->set($id, $data, $ttl);
}
// ------------------------------------------------------------------------
@@ -223,7 +278,7 @@
{
$value = $this->get($key);
- if ($value)
+ if ($value !== FALSE)
{
return array(
'expire' => time() + $this->_redis->ttl($key),
@@ -249,69 +304,6 @@
return FALSE;
}
- return $this->_setup_redis();
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Setup Redis config and connection
- *
- * Loads Redis config file if present. Will halt execution
- * if a Redis connection can't be established.
- *
- * @return bool
- * @see Redis::connect()
- */
- protected function _setup_redis()
- {
- $config = array();
- $CI =& get_instance();
-
- if ($CI->config->load('redis', TRUE, TRUE))
- {
- $config += $CI->config->item('redis');
- }
-
- $config = array_merge(self::$_default_config, $config);
-
- $this->_redis = new Redis();
-
- try
- {
- if ($config['socket_type'] === 'unix')
- {
- $success = $this->_redis->connect($config['socket']);
- }
- else // tcp socket
- {
- $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']);
- }
-
- if ( ! $success)
- {
- log_message('debug', 'Cache: Redis connection refused. Check the config.');
- return FALSE;
- }
- }
- catch (RedisException $e)
- {
- log_message('debug', 'Cache: Redis connection refused ('.$e->getMessage().')');
- return FALSE;
- }
-
- if (isset($config['password']))
- {
- $this->_redis->auth($config['password']);
- }
-
- // Initialize the index of serialized values.
- $serialized = $this->_redis->sMembers('_ci_redis_serialized');
- if ( ! empty($serialized))
- {
- $this->_serialized = array_flip($serialized);
- }
-
return TRUE;
}
@@ -331,5 +323,4 @@
$this->_redis->close();
}
}
-
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Email.php CodeIgniter-3.0.1/system/libraries/Email.php
--- CodeIgniter-3.0.0/system/libraries/Email.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Email.php 2015-08-07 20:31:33.000000000 +0900
@@ -804,11 +804,12 @@
*
* @param string
* @param string
- * @return void
+ * @return CI_Email
*/
public function set_header($header, $value)
{
$this->_headers[$header] = str_replace(array("\n", "\r"), '', $value);
+ return $this;
}
// --------------------------------------------------------------------
@@ -2126,12 +2127,32 @@
protected function _send_data($data)
{
$data .= $this->newline;
- for ($written = 0, $length = strlen($data); $written < $length; $written += $result)
+ for ($written = $timestamp = 0, $length = strlen($data); $written < $length; $written += $result)
{
if (($result = fwrite($this->_smtp_connect, substr($data, $written))) === FALSE)
{
break;
}
+ // See https://bugs.php.net/bug.php?id=39598 and http://php.net/manual/en/function.fwrite.php#96951
+ elseif ($result === 0)
+ {
+ if ($timestamp === 0)
+ {
+ $timestamp = time();
+ }
+ elseif ($timestamp < (time() - $this->smtp_timeout))
+ {
+ $result = FALSE;
+ break;
+ }
+
+ usleep(250000);
+ continue;
+ }
+ else
+ {
+ $timestamp = 0;
+ }
}
if ($result === FALSE)
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Encrypt.php CodeIgniter-3.0.1/system/libraries/Encrypt.php
--- CodeIgniter-3.0.0/system/libraries/Encrypt.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Encrypt.php 2015-08-07 20:31:33.000000000 +0900
@@ -65,7 +65,7 @@
protected $_hash_type = 'sha1';
/**
- * Flag for the existance of mcrypt
+ * Flag for the existence of mcrypt
*
* @var bool
*/
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Encryption.php CodeIgniter-3.0.1/system/libraries/Encryption.php
--- CodeIgniter-3.0.0/system/libraries/Encryption.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Encryption.php 2015-08-07 20:31:33.000000000 +0900
@@ -121,7 +121,7 @@
);
/**
- * List of supported HMAC algorightms
+ * List of supported HMAC algorithms
*
* name => digest size pairs
*
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Form_validation.php CodeIgniter-3.0.1/system/libraries/Form_validation.php
--- CodeIgniter-3.0.0/system/libraries/Form_validation.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Form_validation.php 2015-08-07 20:31:33.000000000 +0900
@@ -198,22 +198,20 @@
return $this;
}
- // No fields? Nothing to do...
- if ( ! is_string($field) OR $field === '')
+ // No fields or no rules? Nothing to do...
+ if ( ! is_string($field) OR $field === '' OR empty($rules))
{
return $this;
}
elseif ( ! is_array($rules))
{
// BC: Convert pipe-separated rules string to an array
- if (is_string($rules))
- {
- $rules = explode('|', $rules);
- }
- else
+ if ( ! is_string($rules))
{
return $this;
}
+
+ $rules = explode('|', $rules);
}
// If the field label wasn't passed we use the field name
@@ -463,7 +461,7 @@
{
$this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']);
}
- elseif (isset($validation_array[$field]) && $validation_array[$field] !== '')
+ elseif (isset($validation_array[$field]))
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
@@ -620,6 +618,12 @@
$rules = array(1 => $rule);
break;
}
+ elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1]))
+ {
+ $callback = TRUE;
+ $rules = array(array($rule[0], $rule[1]));
+ break;
+ }
}
if ( ! $callback)
@@ -817,11 +821,10 @@
// Callable rules might not have named error messages
if ( ! is_string($rule))
{
- return;
+ $line = $this->CI->lang->line('form_validation_error_message_not_set').'(Anonymous function)';
}
-
// Check if a custom message is defined
- if (isset($this->_field_data[$row['field']]['errors'][$rule]))
+ elseif (isset($this->_field_data[$row['field']]['errors'][$rule]))
{
$line = $this->_field_data[$row['field']]['errors'][$rule];
}
@@ -872,18 +875,12 @@
*/
protected function _translate_fieldname($fieldname)
{
- // Do we need to translate the field name?
- // We look for the prefix lang: to determine this
- if (sscanf($fieldname, 'lang:%s', $line) === 1)
- {
- // Were we able to translate the field name? If not we use $line
- if (FALSE === ($fieldname = $this->CI->lang->line('form_validation_'.$line))
- // DEPRECATED support for non-prefixed keys
- && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE)))
+ // Do we need to translate the field name? We look for the prefix 'lang:' to determine this
+ // If we find one, but there's no translation for the string - just return it
+ if (sscanf($fieldname, 'lang:%s', $line) === 1 && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE)))
{
return $line;
}
- }
return $fieldname;
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Ftp.php CodeIgniter-3.0.1/system/libraries/Ftp.php
--- CodeIgniter-3.0.0/system/libraries/Ftp.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Ftp.php 2015-08-07 20:31:33.000000000 +0900
@@ -466,7 +466,7 @@
/**
* Delete a folder and recursively delete everything (including sub-folders)
- * containted within it.
+ * contained within it.
*
* @param string $filepath
* @return bool
@@ -490,7 +490,7 @@
// so we'll recursively call delete_dir()
if ( ! preg_match('#/\.\.?$#', $list[$i]) && ! @ftp_delete($this->conn_id, $list[$i]))
{
- $this->delete_dir($list[$i]);
+ $this->delete_dir($filepath.$list[$i]);
}
}
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Image_lib.php CodeIgniter-3.0.1/system/libraries/Image_lib.php
--- CodeIgniter-3.0.0/system/libraries/Image_lib.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Image_lib.php 2015-08-07 20:31:33.000000000 +0900
@@ -1055,8 +1055,11 @@
if ($this->rotation_angle === 'hor')
{
- for ($i = 0; $i < $height; $i++, $left = 0, $right = $width-1)
+ for ($i = 0; $i < $height; $i++)
{
+ $left = 0;
+ $right = $width - 1;
+
while ($left < $right)
{
$cl = imagecolorat($src_img, $left, $i);
@@ -1072,18 +1075,21 @@
}
else
{
- for ($i = 0; $i < $width; $i++, $top = 0, $bot = $height-1)
+ for ($i = 0; $i < $width; $i++)
{
- while ($top < $bot)
+ $top = 0;
+ $bottom = $height - 1;
+
+ while ($top < $bottom)
{
$ct = imagecolorat($src_img, $i, $top);
- $cb = imagecolorat($src_img, $i, $bot);
+ $cb = imagecolorat($src_img, $i, $bottom);
imagesetpixel($src_img, $i, $top, $cb);
- imagesetpixel($src_img, $i, $bot, $ct);
+ imagesetpixel($src_img, $i, $bottom, $ct);
$top++;
- $bot--;
+ $bottom--;
}
}
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Javascript/Jquery.php CodeIgniter-3.0.1/system/libraries/Javascript/Jquery.php
--- CodeIgniter-3.0.0/system/libraries/Javascript/Jquery.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Javascript/Jquery.php 2015-08-07 20:31:33.000000000 +0900
@@ -84,7 +84,7 @@
public $jquery_table_sorter_active = FALSE;
/**
- * JQuery table sorder pager active
+ * JQuery table sorter pager active
*
* @var bool
*/
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Migration.php CodeIgniter-3.0.1/system/libraries/Migration.php
--- CodeIgniter-3.0.0/system/libraries/Migration.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Migration.php 2015-08-07 20:31:33.000000000 +0900
@@ -191,7 +191,7 @@
* choice
*
* @param string $target_version Target schema version
- * @return mixed TRUE if already latest, FALSE if failed, string if upgraded
+ * @return mixed TRUE if no migrations are found, current version string on success, FALSE on failure
*/
public function version($target_version)
{
@@ -294,7 +294,7 @@
/**
* Sets the schema to the latest migration
*
- * @return mixed TRUE if already latest, FALSE if failed, string if upgraded
+ * @return mixed Current version string on success, FALSE on failure
*/
public function latest()
{
@@ -318,7 +318,7 @@
/**
* Sets the schema to the migration version set in config
*
- * @return mixed TRUE if already current, FALSE if failed, string if upgraded
+ * @return mixed TRUE if no migrations are found, current version string on success, FALSE on failure
*/
public function current()
{
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Pagination.php CodeIgniter-3.0.1/system/libraries/Pagination.php
--- CodeIgniter-3.0.0/system/libraries/Pagination.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Pagination.php 2015-08-07 20:31:33.000000000 +0900
@@ -353,7 +353,8 @@
*/
public function initialize(array $params = array())
{
- if (isset($params['attributes']) && is_array($params['attributes']))
+ isset($params['attributes']) OR $params['attributes'] = array();
+ if (is_array($params['attributes']))
{
$this->_parse_attributes($params['attributes']);
unset($params['attributes']);
@@ -644,7 +645,7 @@
// Kill double slashes. Note: Sometimes we can end up with a double slash
// in the penultimate link so we'll kill all double slashes.
- $output = preg_replace('#([^:])//+#', '\\1/', $output);
+ $output = preg_replace('#([^:"])//+#', '\\1/', $output);
// Add the wrapper HTML if exists
return $this->full_tag_open.$output.$this->full_tag_close;
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Profiler.php CodeIgniter-3.0.1/system/libraries/Profiler.php
--- CodeIgniter-3.0.0/system/libraries/Profiler.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Profiler.php 2015-08-07 20:31:33.000000000 +0900
@@ -100,12 +100,6 @@
$this->CI =& get_instance();
$this->CI->load->language('profiler');
- if (isset($config['query_toggle_count']))
- {
- $this->_query_toggle_count = (int) $config['query_toggle_count'];
- unset($config['query_toggle_count']);
- }
-
// default all sections to display
foreach ($this->_available_sections as $section)
{
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Session/Session.php CodeIgniter-3.0.1/system/libraries/Session/Session.php
--- CodeIgniter-3.0.0/system/libraries/Session/Session.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Session/Session.php 2015-08-07 20:31:33.000000000 +0900
@@ -795,7 +795,7 @@
/**
* Set flashdata
*
- * Legacy CI_Session compatibiliy method
+ * Legacy CI_Session compatibility method
*
* @param mixed $data Session data key or an associative array
* @param mixed $value Value to store
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Session/drivers/Session_memcached_driver.php CodeIgniter-3.0.1/system/libraries/Session/drivers/Session_memcached_driver.php
--- CodeIgniter-3.0.0/system/libraries/Session/drivers/Session_memcached_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Session/drivers/Session_memcached_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -322,7 +322,7 @@
$this->_lock_key = $lock_key;
break;
}
- while ($attempt++ < 30);
+ while (++$attempt < 30);
if ($attempt === 30)
{
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Session/drivers/Session_redis_driver.php CodeIgniter-3.0.1/system/libraries/Session/drivers/Session_redis_driver.php
--- CodeIgniter-3.0.0/system/libraries/Session/drivers/Session_redis_driver.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Session/drivers/Session_redis_driver.php 2015-08-07 20:31:33.000000000 +0900
@@ -336,7 +336,7 @@
$this->_lock_key = $lock_key;
break;
}
- while ($attempt++ < 30);
+ while (++$attempt < 30);
if ($attempt === 30)
{
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Unit_test.php CodeIgniter-3.0.1/system/libraries/Unit_test.php
--- CodeIgniter-3.0.0/system/libraries/Unit_test.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Unit_test.php 2015-08-07 20:31:33.000000000 +0900
@@ -152,7 +152,7 @@
return FALSE;
}
- if (in_array($expected, array('is_object', 'is_string', 'is_bool', 'is_true', 'is_false', 'is_int', 'is_numeric', 'is_float', 'is_double', 'is_array', 'is_null'), TRUE))
+ if (in_array($expected, array('is_object', 'is_string', 'is_bool', 'is_true', 'is_false', 'is_int', 'is_numeric', 'is_float', 'is_double', 'is_array', 'is_null', 'is_resource'), TRUE))
{
$expected = str_replace('is_double', 'is_float', $expected);
$result = $expected($test);
@@ -291,11 +291,13 @@
{
continue;
}
-
+ elseif (in_array($key, array('test_name', 'test_datatype', 'test_res_datatype', 'result'), TRUE))
+ {
if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val), FALSE)))
{
$val = $line;
}
+ }
$temp[$CI->lang->line('ut_'.$key, FALSE)] = $val;
}
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Upload.php CodeIgniter-3.0.1/system/libraries/Upload.php
--- CodeIgniter-3.0.0/system/libraries/Upload.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Upload.php 2015-08-07 20:31:33.000000000 +0900
@@ -397,7 +397,7 @@
if ( ! isset($_file))
{
- $this->set_error('upload_no_file_selected');
+ $this->set_error('upload_no_file_selected', 'debug');
return FALSE;
}
@@ -416,28 +416,28 @@
switch ($error)
{
case UPLOAD_ERR_INI_SIZE:
- $this->set_error('upload_file_exceeds_limit');
+ $this->set_error('upload_file_exceeds_limit', 'info');
break;
case UPLOAD_ERR_FORM_SIZE:
- $this->set_error('upload_file_exceeds_form_limit');
+ $this->set_error('upload_file_exceeds_form_limit', 'info');
break;
case UPLOAD_ERR_PARTIAL:
- $this->set_error('upload_file_partial');
+ $this->set_error('upload_file_partial', 'debug');
break;
case UPLOAD_ERR_NO_FILE:
- $this->set_error('upload_no_file_selected');
+ $this->set_error('upload_no_file_selected', 'debug');
break;
case UPLOAD_ERR_NO_TMP_DIR:
- $this->set_error('upload_no_temp_directory');
+ $this->set_error('upload_no_temp_directory', 'error');
break;
case UPLOAD_ERR_CANT_WRITE:
- $this->set_error('upload_unable_to_write_file');
+ $this->set_error('upload_unable_to_write_file', 'error');
break;
case UPLOAD_ERR_EXTENSION:
- $this->set_error('upload_stopped_by_extension');
+ $this->set_error('upload_stopped_by_extension', 'debug');
break;
default:
- $this->set_error('upload_no_file_selected');
+ $this->set_error('upload_no_file_selected', 'debug');
break;
}
@@ -463,7 +463,7 @@
// Is the file type allowed to be uploaded?
if ( ! $this->is_allowed_filetype())
{
- $this->set_error('upload_invalid_filetype');
+ $this->set_error('upload_invalid_filetype', 'debug');
return FALSE;
}
@@ -485,7 +485,7 @@
if ( ! $this->is_allowed_filetype(TRUE))
{
- $this->set_error('upload_invalid_filetype');
+ $this->set_error('upload_invalid_filetype', 'debug');
return FALSE;
}
}
@@ -499,7 +499,7 @@
// Is the file size within the allowed maximum?
if ( ! $this->is_allowed_filesize())
{
- $this->set_error('upload_invalid_filesize');
+ $this->set_error('upload_invalid_filesize', 'info');
return FALSE;
}
@@ -507,7 +507,7 @@
// Note: This can fail if the server has an open_basedir restriction.
if ( ! $this->is_allowed_dimensions())
{
- $this->set_error('upload_invalid_dimensions');
+ $this->set_error('upload_invalid_dimensions', 'info');
return FALSE;
}
@@ -533,16 +533,10 @@
* If it returns false there was a problem.
*/
$this->orig_name = $this->file_name;
-
- if ($this->overwrite === FALSE)
- {
- $this->file_name = $this->set_filename($this->upload_path, $this->file_name);
-
- if ($this->file_name === FALSE)
+ if (FALSE === ($this->file_name = $this->set_filename($this->upload_path, $this->file_name)))
{
return FALSE;
}
- }
/*
* Run the file through the XSS hacking filter
@@ -552,7 +546,7 @@
*/
if ($this->xss_clean && $this->do_xss_clean() === FALSE)
{
- $this->set_error('upload_unable_to_write_file');
+ $this->set_error('upload_unable_to_write_file', 'error');
return FALSE;
}
@@ -567,7 +561,7 @@
{
if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name))
{
- $this->set_error('upload_destination_error');
+ $this->set_error('upload_destination_error', 'error');
return FALSE;
}
}
@@ -656,7 +650,7 @@
$filename = md5(uniqid(mt_rand())).$this->file_ext;
}
- if ( ! file_exists($path.$filename))
+ if ($this->overwrite === TRUE OR ! file_exists($path.$filename))
{
return $filename;
}
@@ -675,7 +669,7 @@
if ($new_filename === '')
{
- $this->set_error('upload_bad_filename');
+ $this->set_error('upload_bad_filename', 'debug');
return FALSE;
}
else
@@ -701,6 +695,22 @@
// --------------------------------------------------------------------
/**
+ * Set Maximum File Size
+ *
+ * An internal alias to set_max_filesize() to help with configuration
+ * as initialize() will look for a set_<property_name>() method ...
+ *
+ * @param int $n
+ * @return CI_Upload
+ */
+ protected function set_max_size($n)
+ {
+ return $this->set_max_filesize($n);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set Maximum File Name Length
*
* @param int $n
@@ -875,7 +885,7 @@
if (empty($this->allowed_types) OR ! is_array($this->allowed_types))
{
- $this->set_error('upload_no_file_types');
+ $this->set_error('upload_no_file_types', 'debug');
return FALSE;
}
@@ -974,7 +984,7 @@
{
if ($this->upload_path === '')
{
- $this->set_error('upload_no_filepath');
+ $this->set_error('upload_no_filepath', 'error');
return FALSE;
}
@@ -985,13 +995,13 @@
if ( ! is_dir($this->upload_path))
{
- $this->set_error('upload_no_filepath');
+ $this->set_error('upload_no_filepath', 'error');
return FALSE;
}
if ( ! is_really_writable($this->upload_path))
{
- $this->set_error('upload_not_writable');
+ $this->set_error('upload_not_writable', 'error');
return FALSE;
}
@@ -1121,17 +1131,16 @@
* @param string $msg
* @return CI_Upload
*/
- public function set_error($msg)
+ public function set_error($msg, $log_level = 'error')
{
$this->_CI->lang->load('upload');
is_array($msg) OR $msg = array($msg);
-
foreach ($msg as $val)
{
$msg = ($this->_CI->lang->line($val) === FALSE) ? $val : $this->_CI->lang->line($val);
$this->error_msg[] = $msg;
- log_message('error', $msg);
+ log_message($log_level, $msg);
}
return $this;
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Xmlrpc.php CodeIgniter-3.0.1/system/libraries/Xmlrpc.php
--- CodeIgniter-3.0.0/system/libraries/Xmlrpc.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Xmlrpc.php 2015-08-07 20:31:33.000000000 +0900
@@ -735,12 +735,32 @@
.'Content-Length: '.strlen($msg->payload).$r.$r
.$msg->payload;
- for ($written = 0, $length = strlen($op); $written < $length; $written += $result)
+ for ($written = $timestamp = 0, $length = strlen($op); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($op, $written))) === FALSE)
{
break;
}
+ // See https://bugs.php.net/bug.php?id=39598 and http://php.net/manual/en/function.fwrite.php#96951
+ elseif ($result === 0)
+ {
+ if ($timestamp === 0)
+ {
+ $timestamp = time();
+ }
+ elseif ($timestamp < (time() - $this->timeout))
+ {
+ $result = FALSE;
+ break;
+ }
+
+ usleep(250000);
+ continue;
+ }
+ else
+ {
+ $timestamp = 0;
+ }
}
if ($result === FALSE)
diff -uwbrN CodeIgniter-3.0.0/system/libraries/Zip.php CodeIgniter-3.0.1/system/libraries/Zip.php
--- CodeIgniter-3.0.0/system/libraries/Zip.php 2015-04-24 19:00:52.000000000 +0900
+++ CodeIgniter-3.0.1/system/libraries/Zip.php 2015-08-07 20:31:33.000000000 +0900
@@ -352,7 +352,7 @@
// Set the original directory root for child dir's to use as relative
if ($root_path === NULL)
{
- $root_path = dirname($path).DIRECTORY_SEPARATOR;
+ $root_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, dirname($path)).DIRECTORY_SEPARATOR;
}
while (FALSE !== ($file = readdir($fp)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment