From 483e2348a1f40b3591efdd43621d345f25b8f49d Mon Sep 17 00:00:00 2001 From: alext Date: Thu, 29 Jun 2017 15:35:42 +0200 Subject: [PATCH] Updated CodeIgniter to v3.1.5 --- composer.json | 4 +- composer.lock | 192 +++++++++++++++--- src/system/core/CodeIgniter.php | 4 +- src/system/core/Common.php | 2 +- src/system/core/Exceptions.php | 2 +- src/system/core/Output.php | 107 +++++----- src/system/core/compat/mbstring.php | 2 +- src/system/database/DB_cache.php | 2 +- src/system/database/DB_forge.php | 6 +- src/system/database/DB_query_builder.php | 2 +- .../database/drivers/ibase/ibase_forge.php | 2 +- .../database/drivers/oci8/oci8_forge.php | 2 +- .../drivers/pdo/subdrivers/pdo_oci_forge.php | 2 +- src/system/helpers/form_helper.php | 10 +- src/system/helpers/inflector_helper.php | 1 + src/system/libraries/Email.php | 26 +-- src/system/libraries/Form_validation.php | 4 +- .../Session/drivers/Session_redis_driver.php | 2 +- src/system/libraries/Table.php | 2 +- src/system/libraries/Xmlrpc.php | 2 +- 20 files changed, 248 insertions(+), 128 deletions(-) diff --git a/composer.json b/composer.json index f2f0a4f0..b0a10c6e 100644 --- a/composer.json +++ b/composer.json @@ -27,13 +27,13 @@ }, "minimum-stability": "stable", "require-dev": { - "codeigniter/framework": "~3.1.4", "phpunit/phpunit": "^5.6" }, "require": { "php": ">=5.6", "roave/security-advisories": "dev-master", "gregwar/captcha": "^1.1", - "phpmailer/phpmailer": "^5.2" + "phpmailer/phpmailer": "^5.2", + "codeigniter/framework": "3.1.5" } } diff --git a/composer.lock b/composer.lock index 055117ce..846a62eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,41 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "25bac256233b0471e7cc3b8922e61b61", + "content-hash": "9291221da0af4f9eeb4fb70314d354f2", "packages": [ + { + "name": "codeigniter/framework", + "version": "3.1.5", + "source": { + "type": "git", + "url": "https://github.com/bcit-ci/CodeIgniter.git", + "reference": "6c7a4266410070d30f8f6bcdf9c9e67f3d6478e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/6c7a4266410070d30f8f6bcdf9c9e67f3d6478e3", + "reference": "6c7a4266410070d30f8f6bcdf9c9e67f3d6478e3", + "shasum": "" + }, + "require": { + "php": ">=5.3.7" + }, + "require-dev": { + "mikey179/vfsstream": "1.1.*", + "phpunit/phpunit": "4.* || 5.*" + }, + "suggest": { + "paragonie/random_compat": "Provides better randomness in PHP 5.x" + }, + "type": "project", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The CodeIgniter framework", + "homepage": "https://codeigniter.com", + "time": "2017-06-19T08:33:58+00:00" + }, { "name": "gregwar/captcha", "version": "v1.1.1", @@ -129,42 +162,145 @@ ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "time": "2017-03-15T19:32:56+00:00" - } - ], - "packages-dev": [ + }, { - "name": "codeigniter/framework", - "version": "3.1.4", + "name": "roave/security-advisories", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/bcit-ci/CodeIgniter.git", - "reference": "873608df8be83420474e3cf9fc749a8ed12a6c09" + "url": "https://github.com/Roave/SecurityAdvisories.git", + "reference": "0b18b6bbeed070fb900ad78e81ffa1182a57a752" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/873608df8be83420474e3cf9fc749a8ed12a6c09", - "reference": "873608df8be83420474e3cf9fc749a8ed12a6c09", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/0b18b6bbeed070fb900ad78e81ffa1182a57a752", + "reference": "0b18b6bbeed070fb900ad78e81ffa1182a57a752", "shasum": "" }, - "require": { - "php": ">=5.2.4" + "conflict": { + "adodb/adodb-php": "<5.20.6", + "amphp/artax": ">=2,<2.0.6|<1.0.6", + "aws/aws-sdk-php": ">=3,<3.2.1", + "bugsnag/bugsnag-laravel": ">=2,<2.0.2", + "cakephp/cakephp": ">=3,<3.0.15|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=1.3,<1.3.18|>=2.7,<2.7.6|>=3.1,<3.1.4", + "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cartalyst/sentry": "<2.1", + "codeigniter/framework": "<=3.0.6", + "composer/composer": "<=1.0.0-alpha11", + "contao-components/mediaelement": ">=2.14.2,<2.21.1", + "contao/core": ">=2.11,<3.5.15", + "doctrine/annotations": ">=1,<1.2.7", + "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", + "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", + "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2", + "doctrine/doctrine-bundle": "<1.5.2", + "doctrine/doctrine-module": "<=0.7.1", + "doctrine/mongodb-odm": ">=1,<1.0.2", + "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", + "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", + "dompdf/dompdf": ">=0.6,<0.6.2", + "drupal/core": ">=8,<8.3.4", + "drupal/drupal": ">=8,<8.3.4", + "firebase/php-jwt": "<2", + "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", + "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "gregwar/rst": "<1.0.3", + "guzzlehttp/guzzle": ">=6,<6.2.1|>=4.0.0-rc2,<4.2.4|>=5,<5.3.1", + "illuminate/auth": ">=4,<4.0.99|>=4.1,<4.1.26", + "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", + "joomla/session": "<1.3.1", + "laravel/framework": ">=4,<4.0.99|>=4.1,<4.1.29", + "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "magento/magento1ce": ">=1.5.0.1,<1.9.3.2", + "magento/magento1ee": ">=1.9,<1.14.3.2", + "magento/magento2ce": ">=2,<2.2", + "monolog/monolog": ">=1.8,<1.12", + "namshi/jose": "<2.2", + "onelogin/php-saml": "<2.10.4", + "oro/crm": ">=1.7,<1.7.4", + "oro/platform": ">=1.7,<1.7.4", + "phpmailer/phpmailer": ">=5,<5.2.22", + "pusher/pusher-php-server": "<2.2.1", + "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", + "shopware/shopware": "<4.4|>=5,<5.2.16", + "silverstripe/cms": ">=3.1,<3.1.11|>=3,<=3.0.11", + "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", + "silverstripe/framework": ">=3,<3.3", + "silverstripe/userforms": "<3", + "simplesamlphp/saml2": "<1.8.1|>=1.9,<1.9.1|>=1.10,<1.10.3|>=2,<2.3.3", + "simplesamlphp/simplesamlphp": "<1.14.12", + "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", + "socalnick/scn-social-auth": "<1.15.2", + "squizlabs/php_codesniffer": ">=1,<2.8.1", + "swiftmailer/swiftmailer": ">=4,<5.4.5", + "symfony/dependency-injection": ">=2,<2.0.17", + "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.7", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2", + "symfony/http-foundation": ">=2,<2.3.27|>=2.4,<2.5.11|>=2.6,<2.6.6", + "symfony/http-kernel": ">=2,<2.3.29|>=2.4,<2.5.12|>=2.6,<2.6.8", + "symfony/routing": ">=2,<2.0.19", + "symfony/security": ">=2.3,<2.3.37|>=2.4,<2.6.13|>=2.7,<2.7.9|>=2,<2.0.25|>=2.1,<2.1.13|>=2.2,<2.2.9", + "symfony/security-core": ">=2.8,<2.8.6|>=3,<3.0.6|>=2.4,<2.6.13|>=2.7,<2.7.9", + "symfony/security-http": ">=2.4,<2.7.13|>=2.3,<2.3.41|>=2.8,<2.8.6|>=3,<3.0.6", + "symfony/serializer": ">=2,<2.0.11", + "symfony/symfony": ">=2,<2.3.41|>=2.4,<2.7.13|>=2.8,<2.8.6|>=3,<3.0.6", + "symfony/translation": ">=2,<2.0.17", + "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", + "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", + "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", + "thelia/backoffice-default-template": ">=2.1,<2.1.2", + "thelia/thelia": ">=2.1.0-beta1,<2.1.3|>=2.1,<2.1.2", + "twig/twig": "<1.20", + "typo3/cms": ">=6.2,<6.2.30|>=8,<8.6.1|>=7,<7.6.16", + "typo3/flow": ">=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5|>=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1", + "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", + "willdurand/js-translation-bundle": "<2.1.1", + "yiisoft/yii": ">=1.1.14,<1.1.15", + "yiisoft/yii2": "<2.0.5", + "yiisoft/yii2-bootstrap": "<2.0.4", + "yiisoft/yii2-dev": "<2.0.4", + "yiisoft/yii2-gii": "<2.0.4", + "yiisoft/yii2-jui": "<2.0.4", + "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", + "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-diactoros": ">=1,<1.0.4", + "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-http": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.3,<2.3.8|>=2.4,<2.4.1", + "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", + "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", + "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", + "zendframework/zend-validator": ">=2.3,<2.3.6", + "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zendframework": ">=2,<2.4.11|>=2.5,<2.5.1", + "zendframework/zendframework1": "<1.12.20", + "zendframework/zendopenid": ">=2,<2.0.2", + "zendframework/zendxml": ">=1,<1.0.1", + "zf-commons/zfc-user": "<1.2.2", + "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", + "zfr/zfr-oauth2-server-module": "<0.1.2" }, - "require-dev": { - "mikey179/vfsstream": "1.1.*", - "phpunit/phpunit": "4.* || 5.*" - }, - "suggest": { - "paragonie/random_compat": "Provides better randomness in PHP 5.x" - }, - "type": "project", + "type": "metapackage", "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "The CodeIgniter framework", - "homepage": "https://codeigniter.com", - "time": "2017-03-20T15:51:08+00:00" - }, + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "role": "maintainer" + } + ], + "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", + "time": "2017-06-22T16:43:17+00:00" + } + ], + "packages-dev": [ { "name": "doctrine/instantiator", "version": "1.0.5", @@ -1469,9 +1605,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "roave/security-advisories": 20 + }, "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": ">=5.6" + }, "platform-dev": [] } diff --git a/src/system/core/CodeIgniter.php b/src/system/core/CodeIgniter.php index 880abab5..823e034d 100644 --- a/src/system/core/CodeIgniter.php +++ b/src/system/core/CodeIgniter.php @@ -55,7 +55,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @var string * */ - const CI_VERSION = '3.1.4'; + const CI_VERSION = '3.1.5'; /* * ------------------------------------------------------ @@ -434,7 +434,7 @@ if ( ! is_php('5.4')) * ReflectionMethod::isConstructor() is the ONLY reliable check, * knowing which method will be executed as a constructor. */ - elseif ( ! is_callable(array($class, $method)) && strcasecmp($class, $method) === 0) + elseif ( ! is_callable(array($class, $method))) { $reflection = new ReflectionMethod($class, $method); if ( ! $reflection->isPublic() OR $reflection->isConstructor()) diff --git a/src/system/core/Common.php b/src/system/core/Common.php index 2fd5c580..d6a1fdb4 100644 --- a/src/system/core/Common.php +++ b/src/system/core/Common.php @@ -135,7 +135,7 @@ if ( ! function_exists('load_class')) * * @param string the class name being requested * @param string the directory where the class should be found - * @param string an optional argument to pass to the class constructor + * @param mixed an optional argument to pass to the class constructor * @return object */ function &load_class($class, $directory = 'libraries', $param = NULL) diff --git a/src/system/core/Exceptions.php b/src/system/core/Exceptions.php index 47d153f4..52690960 100644 --- a/src/system/core/Exceptions.php +++ b/src/system/core/Exceptions.php @@ -231,7 +231,7 @@ class CI_Exceptions { * @param string $message Error message * @param string $filepath File path * @param int $line Line number - * @return string Error page output + * @return void */ public function show_php_error($severity, $message, $filepath, $line) { diff --git a/src/system/core/Output.php b/src/system/core/Output.php index 6ddded22..a3155fec 100644 --- a/src/system/core/Output.php +++ b/src/system/core/Output.php @@ -586,62 +586,59 @@ class CI_Output { return; } - if (flock($fp, LOCK_EX)) - { - // If output compression is enabled, compress the cache - // itself, so that we don't have to do that each time - // we're serving it - if ($this->_compress_output === TRUE) - { - $output = gzencode($output); - - if ($this->get_header('content-type') === NULL) - { - $this->set_content_type($this->mime_type); - } - } - - $expire = time() + ($this->cache_expiration * 60); - - // Put together our serialized info. - $cache_info = serialize(array( - 'expire' => $expire, - 'headers' => $this->headers - )); - - $output = $cache_info.'ENDCI--->'.$output; - - for ($written = 0, $length = self::strlen($output); $written < $length; $written += $result) - { - if (($result = fwrite($fp, self::substr($output, $written))) === FALSE) - { - break; - } - } - - flock($fp, LOCK_UN); - } - else + if ( ! flock($fp, LOCK_EX)) { log_message('error', 'Unable to secure a file lock for file at: '.$cache_path); + fclose($fp); return; } + // If output compression is enabled, compress the cache + // itself, so that we don't have to do that each time + // we're serving it + if ($this->_compress_output === TRUE) + { + $output = gzencode($output); + + if ($this->get_header('content-type') === NULL) + { + $this->set_content_type($this->mime_type); + } + } + + $expire = time() + ($this->cache_expiration * 60); + + // Put together our serialized info. + $cache_info = serialize(array( + 'expire' => $expire, + 'headers' => $this->headers + )); + + $output = $cache_info.'ENDCI--->'.$output; + + for ($written = 0, $length = self::strlen($output); $written < $length; $written += $result) + { + if (($result = fwrite($fp, self::substr($output, $written))) === FALSE) + { + break; + } + } + + flock($fp, LOCK_UN); fclose($fp); - if (is_int($result)) - { - chmod($cache_path, 0640); - log_message('debug', 'Cache file written: '.$cache_path); - - // Send HTTP cache-control headers to browser to match file cache settings. - $this->set_cache_header($_SERVER['REQUEST_TIME'], $expire); - } - else + if ( ! is_int($result)) { @unlink($cache_path); log_message('error', 'Unable to write the complete cache content at: '.$cache_path); + return; } + + chmod($cache_path, 0640); + log_message('debug', 'Cache file written: '.$cache_path); + + // Send HTTP cache-control headers to browser to match file cache settings. + $this->set_cache_header($_SERVER['REQUEST_TIME'], $expire); } // -------------------------------------------------------------------- @@ -708,11 +705,9 @@ class CI_Output { log_message('debug', 'Cache file has expired. File deleted.'); return FALSE; } - else - { - // Or else send the HTTP cache control headers. - $this->set_cache_header($last_modified, $expire); - } + + // Send the HTTP cache control headers + $this->set_cache_header($last_modified, $expire); // Add headers from cache file. foreach ($cache_info['headers'] as $header) @@ -798,13 +793,11 @@ class CI_Output { $this->set_status_header(304); exit; } - else - { - header('Pragma: public'); - header('Cache-Control: max-age='.$max_age.', public'); - header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT'); - header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT'); - } + + header('Pragma: public'); + header('Cache-Control: max-age='.$max_age.', public'); + header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT'); + header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT'); } // -------------------------------------------------------------------- diff --git a/src/system/core/compat/mbstring.php b/src/system/core/compat/mbstring.php index f466e1c3..1b2f2c63 100644 --- a/src/system/core/compat/mbstring.php +++ b/src/system/core/compat/mbstring.php @@ -68,7 +68,7 @@ if ( ! function_exists('mb_strlen')) * @link http://php.net/mb_strlen * @param string $str * @param string $encoding - * @return string + * @return int */ function mb_strlen($str, $encoding = NULL) { diff --git a/src/system/database/DB_cache.php b/src/system/database/DB_cache.php index b74c3192..7c8ee5fc 100644 --- a/src/system/database/DB_cache.php +++ b/src/system/database/DB_cache.php @@ -143,7 +143,7 @@ class CI_DB_Cache { $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); - if (FALSE === ($cachedata = @file_get_contents($filepath))) + if ( ! is_file($filepath) OR FALSE === ($cachedata = file_get_contents($filepath))) { return FALSE; } diff --git a/src/system/database/DB_forge.php b/src/system/database/DB_forge.php index 7289235c..3cb02ca4 100644 --- a/src/system/database/DB_forge.php +++ b/src/system/database/DB_forge.php @@ -488,7 +488,7 @@ abstract class CI_DB_forge { * * @param string $table Table name * @param bool $if_exists Whether to add an IF EXISTS condition - * @return string + * @return mixed (Returns a platform-specific DROP table string, or TRUE to indicate there's nothing to do) */ protected function _drop_table($table, $if_exists) { @@ -979,8 +979,8 @@ abstract class CI_DB_forge { /** * Process indexes * - * @param string $table - * @return string + * @param string $table Table name + * @return string[] list of SQL statements */ protected function _process_indexes($table) { diff --git a/src/system/database/DB_query_builder.php b/src/system/database/DB_query_builder.php index 0abf2a26..9216651a 100644 --- a/src/system/database/DB_query_builder.php +++ b/src/system/database/DB_query_builder.php @@ -1409,7 +1409,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $this->qb_orderby = NULL; } - $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby)) + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset) ? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results") : $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); diff --git a/src/system/database/drivers/ibase/ibase_forge.php b/src/system/database/drivers/ibase/ibase_forge.php index 44bb24e6..31352f12 100644 --- a/src/system/database/drivers/ibase/ibase_forge.php +++ b/src/system/database/drivers/ibase/ibase_forge.php @@ -91,7 +91,7 @@ class CI_DB_ibase_forge extends CI_DB_forge { * Create database * * @param string $db_name - * @return string + * @return bool */ public function create_database($db_name) { diff --git a/src/system/database/drivers/oci8/oci8_forge.php b/src/system/database/drivers/oci8/oci8_forge.php index 867a9434..724a76df 100644 --- a/src/system/database/drivers/oci8/oci8_forge.php +++ b/src/system/database/drivers/oci8/oci8_forge.php @@ -124,7 +124,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { if ($alter_type === 'MODIFY' && ! empty($field[$i]['new_name'])) { $sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .' '.$this->db->escape_identifiers($field[$i]['new_name']); + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); } $field[$i] = "\n\t".$field[$i]['_literal']; diff --git a/src/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/src/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php index c8983ee5..813207b8 100644 --- a/src/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php +++ b/src/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php @@ -117,7 +117,7 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge { if ($alter_type === 'MODIFY' && ! empty($field[$i]['new_name'])) { $sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name']) - .' '.$this->db->escape_identifiers($field[$i]['new_name']); + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); } } } diff --git a/src/system/helpers/form_helper.php b/src/system/helpers/form_helper.php index a49eea80..13f19631 100644 --- a/src/system/helpers/form_helper.php +++ b/src/system/helpers/form_helper.php @@ -597,7 +597,7 @@ if ( ! function_exists('form_label')) * * @param string The text to appear onscreen * @param string The id the label applies to - * @param array Additional attributes + * @param mixed Additional attributes * @return string */ function form_label($label_text = '', $id = '', $attributes = array()) @@ -610,13 +610,7 @@ if ( ! function_exists('form_label')) $label .= ' for="'.$id.'"'; } - if (is_array($attributes) && count($attributes) > 0) - { - foreach ($attributes as $key => $val) - { - $label .= ' '.$key.'="'.$val.'"'; - } - } + $label .= _attributes_to_string($attributes); return $label.'>'.$label_text.''; } diff --git a/src/system/helpers/inflector_helper.php b/src/system/helpers/inflector_helper.php index 26a5a5ca..4a6805fb 100644 --- a/src/system/helpers/inflector_helper.php +++ b/src/system/helpers/inflector_helper.php @@ -95,6 +95,7 @@ if ( ! function_exists('singular')) '/(s)tatuses$/' => '\1\2tatus', '/(c)hildren$/' => '\1\2hild', '/(n)ews$/' => '\1\2ews', + '/(quiz)zes$/' => '\1', '/([^us])s$/' => '\1' ); diff --git a/src/system/libraries/Email.php b/src/system/libraries/Email.php index 955787d2..0e9cf057 100644 --- a/src/system/libraries/Email.php +++ b/src/system/libraries/Email.php @@ -913,18 +913,13 @@ class CI_Email { /** * Get Mail Protocol * - * @param bool * @return mixed */ - protected function _get_protocol($return = TRUE) + protected function _get_protocol() { $this->protocol = strtolower($this->protocol); in_array($this->protocol, $this->_protocols, TRUE) OR $this->protocol = 'mail'; - - if ($return === TRUE) - { - return $this->protocol; - } + return $this->protocol; } // -------------------------------------------------------------------- @@ -932,25 +927,21 @@ class CI_Email { /** * Get Mail Encoding * - * @param bool * @return string */ - protected function _get_encoding($return = TRUE) + protected function _get_encoding() { in_array($this->_encoding, $this->_bit_depths) OR $this->_encoding = '8bit'; foreach ($this->_base_charsets as $charset) { - if (strpos($charset, $this->charset) === 0) + if (strpos($this->charset, $charset) === 0) { $this->_encoding = '7bit'; } } - if ($return === TRUE) - { - return $this->_encoding; - } + return $this->_encoding; } // -------------------------------------------------------------------- @@ -1829,14 +1820,15 @@ class CI_Email { { $this->_unwrap_specials(); - $method = '_send_with_'.$this->_get_protocol(); + $protocol = $this->_get_protocol(); + $method = '_send_with_'.$protocol; if ( ! $this->$method()) { - $this->_set_error_message('lang:email_send_failure_'.($this->_get_protocol() === 'mail' ? 'phpmail' : $this->_get_protocol())); + $this->_set_error_message('lang:email_send_failure_'.($protocol === 'mail' ? 'phpmail' : $protocol)); return FALSE; } - $this->_set_error_message('lang:email_sent', $this->_get_protocol()); + $this->_set_error_message('lang:email_sent', $protocol); return TRUE; } diff --git a/src/system/libraries/Form_validation.php b/src/system/libraries/Form_validation.php index 4f679a17..71d0e64b 100644 --- a/src/system/libraries/Form_validation.php +++ b/src/system/libraries/Form_validation.php @@ -1229,9 +1229,9 @@ class CI_Form_validation { */ public function valid_email($str) { - if (function_exists('idn_to_ascii') && sscanf($str, '%[^@]@%s', $name, $domain) === 2) + if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches)) { - $str = $name.'@'.idn_to_ascii($domain); + $str = $matches[1].'@'.idn_to_ascii($matches[2]); } return (bool) filter_var($str, FILTER_VALIDATE_EMAIL); diff --git a/src/system/libraries/Session/drivers/Session_redis_driver.php b/src/system/libraries/Session/drivers/Session_redis_driver.php index d260f7b8..e220a295 100644 --- a/src/system/libraries/Session/drivers/Session_redis_driver.php +++ b/src/system/libraries/Session/drivers/Session_redis_driver.php @@ -51,7 +51,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle /** * phpRedis instance * - * @var resource + * @var Redis */ protected $_redis; diff --git a/src/system/libraries/Table.php b/src/system/libraries/Table.php index fef9bb03..50c5e358 100644 --- a/src/system/libraries/Table.php +++ b/src/system/libraries/Table.php @@ -435,7 +435,7 @@ class CI_Table { /** * Set table data from a database result object * - * @param CI_DB_result $db_result Database result object + * @param CI_DB_result $object Database result object * @return void */ protected function _set_from_db_result($object) diff --git a/src/system/libraries/Xmlrpc.php b/src/system/libraries/Xmlrpc.php index c766a89c..6fa79186 100644 --- a/src/system/libraries/Xmlrpc.php +++ b/src/system/libraries/Xmlrpc.php @@ -1886,7 +1886,7 @@ class XML_RPC_Values extends CI_Xmlrpc public function serializeval($o) { $array = $o->me; - list($value, $type) = array(reset($ar), key($array)); + list($value, $type) = array(reset($array), key($array)); return "\n".$this->serializedata($type, $value)."\n"; }