summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes6
-rw-r--r--.github/workflows/test-phpunit.yml119
-rw-r--r--.travis.yml63
-rw-r--r--application/config/config.php15
-rw-r--r--application/config/hooks.php2
-rw-r--r--application/config/memcached.php2
-rw-r--r--application/config/mimes.php8
-rw-r--r--application/config/profiler.php2
-rw-r--r--application/config/routes.php2
-rw-r--r--application/config/user_agents.php3
-rw-r--r--application/controllers/Welcome.php2
-rwxr-xr-xbuild-release.sh3
-rw-r--r--composer.json16
-rw-r--r--contributing.md2
-rwxr-xr-xindex.php2
-rw-r--r--readme.rst3
-rw-r--r--system/core/Benchmark.php2
-rw-r--r--system/core/CodeIgniter.php4
-rw-r--r--system/core/Common.php9
-rw-r--r--system/core/Config.php2
-rw-r--r--system/core/Controller.php2
-rw-r--r--system/core/Exceptions.php2
-rw-r--r--system/core/Hooks.php2
-rw-r--r--system/core/Input.php51
-rw-r--r--system/core/Lang.php2
-rw-r--r--system/core/Loader.php2
-rw-r--r--system/core/Log.php4
-rw-r--r--system/core/Model.php2
-rw-r--r--system/core/Output.php14
-rw-r--r--system/core/Router.php2
-rw-r--r--system/core/Security.php40
-rw-r--r--system/core/URI.php2
-rw-r--r--system/core/Utf8.php2
-rw-r--r--system/core/compat/hash.php2
-rw-r--r--system/core/compat/mbstring.php2
-rw-r--r--system/core/compat/password.php2
-rw-r--r--system/core/compat/standard.php2
-rw-r--r--system/database/DB.php2
-rw-r--r--system/database/DB_cache.php2
-rw-r--r--system/database/DB_driver.php4
-rw-r--r--system/database/DB_forge.php2
-rw-r--r--system/database/DB_query_builder.php4
-rw-r--r--system/database/DB_result.php2
-rw-r--r--system/database/DB_utility.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_forge.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_result.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_utility.php2
-rw-r--r--system/database/drivers/ibase/ibase_driver.php2
-rw-r--r--system/database/drivers/ibase/ibase_forge.php2
-rw-r--r--system/database/drivers/ibase/ibase_result.php2
-rw-r--r--system/database/drivers/ibase/ibase_utility.php2
-rw-r--r--system/database/drivers/mssql/mssql_driver.php2
-rw-r--r--system/database/drivers/mssql/mssql_forge.php2
-rw-r--r--system/database/drivers/mssql/mssql_result.php2
-rw-r--r--system/database/drivers/mssql/mssql_utility.php2
-rw-r--r--system/database/drivers/mysql/mysql_driver.php2
-rw-r--r--system/database/drivers/mysql/mysql_forge.php2
-rw-r--r--system/database/drivers/mysql/mysql_result.php2
-rw-r--r--system/database/drivers/mysql/mysql_utility.php2
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php9
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php2
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php2
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php2
-rw-r--r--system/database/drivers/oci8/oci8_driver.php2
-rw-r--r--system/database/drivers/oci8/oci8_forge.php2
-rw-r--r--system/database/drivers/oci8/oci8_result.php2
-rw-r--r--system/database/drivers/oci8/oci8_utility.php2
-rw-r--r--system/database/drivers/odbc/odbc_driver.php2
-rw-r--r--system/database/drivers/odbc/odbc_result.php2
-rw-r--r--system/database/drivers/pdo/pdo_driver.php23
-rw-r--r--system/database/drivers/pdo/pdo_result.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_4d_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_4d_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_informix_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_informix_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_oci_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_oci_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php6
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php9
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php2
-rw-r--r--system/database/drivers/postgre/postgre_driver.php25
-rw-r--r--system/database/drivers/postgre/postgre_forge.php2
-rw-r--r--system/database/drivers/postgre/postgre_result.php4
-rw-r--r--system/database/drivers/postgre/postgre_utility.php2
-rw-r--r--system/database/drivers/sqlite3/sqlite3_driver.php2
-rw-r--r--system/database/drivers/sqlite3/sqlite3_forge.php2
-rw-r--r--system/database/drivers/sqlite3/sqlite3_result.php2
-rw-r--r--system/database/drivers/sqlite3/sqlite3_utility.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_forge.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_result.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_utility.php2
-rw-r--r--system/helpers/array_helper.php2
-rw-r--r--system/helpers/captcha_helper.php8
-rw-r--r--system/helpers/cookie_helper.php2
-rw-r--r--system/helpers/date_helper.php2
-rw-r--r--system/helpers/directory_helper.php2
-rw-r--r--system/helpers/download_helper.php2
-rw-r--r--system/helpers/file_helper.php2
-rw-r--r--system/helpers/form_helper.php2
-rw-r--r--system/helpers/html_helper.php2
-rw-r--r--system/helpers/inflector_helper.php2
-rw-r--r--system/helpers/language_helper.php2
-rw-r--r--system/helpers/number_helper.php2
-rw-r--r--system/helpers/path_helper.php2
-rw-r--r--system/helpers/security_helper.php2
-rw-r--r--system/helpers/string_helper.php2
-rw-r--r--system/helpers/text_helper.php2
-rw-r--r--system/helpers/typography_helper.php2
-rw-r--r--system/helpers/url_helper.php2
-rw-r--r--system/helpers/xml_helper.php2
-rw-r--r--system/libraries/Calendar.php2
-rw-r--r--system/libraries/Email.php4
-rw-r--r--system/libraries/Encrypt.php4
-rw-r--r--system/libraries/Encryption.php14
-rw-r--r--system/libraries/Form_validation.php4
-rw-r--r--system/libraries/Ftp.php4
-rw-r--r--system/libraries/Image_lib.php7
-rw-r--r--system/libraries/Migration.php2
-rw-r--r--system/libraries/Pagination.php2
-rw-r--r--system/libraries/Parser.php2
-rw-r--r--system/libraries/Profiler.php2
-rw-r--r--system/libraries/Session/CI_Session_driver_interface.php58
-rw-r--r--system/libraries/Session/OldSessionWrapper.php88
-rw-r--r--system/libraries/Session/PHP8SessionWrapper.php90
-rw-r--r--system/libraries/Session/Session.php115
-rw-r--r--system/libraries/Session/Session_driver.php31
-rw-r--r--system/libraries/Session/drivers/Session_database_driver.php7
-rw-r--r--system/libraries/Session/drivers/Session_files_driver.php9
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php7
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php9
-rw-r--r--system/libraries/Table.php2
-rw-r--r--system/libraries/Trackback.php2
-rw-r--r--system/libraries/Typography.php2
-rw-r--r--system/libraries/Unit_test.php2
-rw-r--r--system/libraries/Upload.php4
-rw-r--r--system/libraries/User_agent.php4
-rw-r--r--system/libraries/Xmlrpc.php12
-rw-r--r--system/libraries/Xmlrpcs.php4
-rw-r--r--system/libraries/Zip.php4
-rw-r--r--tests/Bootstrap.php7
-rw-r--r--tests/codeigniter/Setup_test.php2
-rw-r--r--tests/codeigniter/core/Input_test.php14
-rw-r--r--tests/codeigniter/core/Loader_test.php39
-rw-r--r--tests/codeigniter/core/Security_test.php5
-rw-r--r--tests/codeigniter/core/compat/mbstring_test.php14
-rw-r--r--tests/codeigniter/database/query_builder/select_test.php2
-rw-r--r--tests/codeigniter/helpers/array_helper_test.php4
-rw-r--r--tests/codeigniter/helpers/file_helper_test.php5
-rw-r--r--tests/codeigniter/helpers/string_helper_test.php2
-rw-r--r--tests/codeigniter/helpers/text_helper_test.php5
-rw-r--r--tests/codeigniter/libraries/Driver_test.php16
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php4
-rw-r--r--tests/codeigniter/libraries/Table_test.php12
-rw-r--r--tests/codeigniter/libraries/Useragent_test.php4
-rw-r--r--tests/mocks/ci_testcase.php18
-rwxr-xr-xtests/mocks/database/ci_test.sqlitebin19456 -> 19456 bytes
-rw-r--r--tests/mocks/database/config/mysql.php10
-rw-r--r--tests/mocks/database/config/mysqli.php10
-rw-r--r--tests/mocks/database/config/pdo/mysql.php14
-rw-r--r--tests/mocks/database/config/pdo/pgsql.php4
-rw-r--r--tests/mocks/database/config/pgsql.php4
-rw-r--r--tests/mocks/database/schema/skeleton.php10
-rw-r--r--tests/phpunit.xml3
-rw-r--r--tests/travis/mysql.phpunit.xml3
-rw-r--r--tests/travis/mysqli.phpunit.xml3
-rw-r--r--tests/travis/pdo/mysql.phpunit.xml3
-rw-r--r--tests/travis/pdo/pgsql.phpunit.xml3
-rw-r--r--tests/travis/pdo/sqlite.phpunit.xml3
-rw-r--r--tests/travis/pgsql.phpunit.xml3
-rw-r--r--tests/travis/sqlite.phpunit.xml36
-rw-r--r--user_guide_src/source/changelog.rst16
-rw-r--r--user_guide_src/source/database/db_driver_reference.rst2
-rw-r--r--user_guide_src/source/installation/upgrade_150.rst4
-rw-r--r--user_guide_src/source/installation/upgrade_3112.rst6
-rw-r--r--user_guide_src/source/libraries/input.rst21
-rw-r--r--user_guide_src/source/libraries/sessions.rst2
192 files changed, 1017 insertions, 447 deletions
diff --git a/.gitattributes b/.gitattributes
index a4296d591..b4f0b6cbb 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -18,8 +18,6 @@ readme.rst
tests/codeigniter/ export-ignore
tests/travis/ export-ignore
-# User Guide Source Files
-user_guide_src
-
-# User Guide Compiled Files
+# User Guide source files and compiled files
+user_guide_src export-ignore
user_guide export-ignore
diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml
new file mode 100644
index 000000000..a0765e883
--- /dev/null
+++ b/.github/workflows/test-phpunit.yml
@@ -0,0 +1,119 @@
+name: PHPUnit
+
+on: [push, pull_request]
+
+jobs:
+ tests:
+ runs-on: ubuntu-18.04
+ if: "!contains(github.event.head_commit.message, '[ci skip]')"
+ env:
+ PHP_INI_VALUES: assert.exception=1, zend.assertions=1
+
+ strategy:
+ fail-fast: false
+ matrix:
+ php: [ '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4']
+ DB: [ 'pdo/mysql', 'pdo/pgsql', 'pdo/sqlite', 'mysqli', 'pgsql', 'sqlite' ]
+ compiler: [ default ]
+ include:
+ - php: '8.1'
+ DB: 'pdo/mysql'
+ compiler: jit
+ - php: '8.1'
+ DB: 'pdo/pgsql'
+ compiler: jit
+ - php: '8.1'
+ DB: 'pdo/sqlite'
+ compiler: jit
+ - php: '8.1'
+ DB: 'mysqli'
+ compiler: jit
+ - php: '8.1'
+ DB: 'pgsql'
+ compiler: jit
+ - php: '8.1'
+ DB: 'sqlite'
+ compiler: jit
+ - php: '8.0'
+ DB: 'pdo/mysql'
+ compiler: jit
+ - php: '8.0'
+ DB: 'pdo/pgsql'
+ compiler: jit
+ - php: '8.0'
+ DB: 'pdo/sqlite'
+ compiler: jit
+ - php: '8.0'
+ DB: 'mysqli'
+ compiler: jit
+ - php: '8.0'
+ DB: 'pgsql'
+ compiler: jit
+ - php: '8.0'
+ DB: 'sqlite'
+ compiler: jit
+ - php: '5.6'
+ DB: 'mysql'
+ compiler: default
+ - php: '5.5'
+ DB: 'mysql'
+ compiler: default
+ - php: '5.4'
+ DB: 'mysql'
+ compiler: default
+
+ services:
+ postgres:
+ image: postgres:12
+ env:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: ci_test
+ ports:
+ - 5432:5432
+ options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
+
+ mysql:
+ image: mysql:5.7
+ env:
+ MYSQL_ALLOW_EMPTY_PASSWORD: true
+ MYSQL_USER: travis
+ MYSQL_PASSWORD: travis
+ MYSQL_DATABASE: ci_test
+ ports:
+ - 3306:3306
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Override PHP ini values for JIT compiler
+ if: matrix.compiler == 'jit'
+ run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=64M" >> $GITHUB_ENV
+
+ - name: Install PHP${{ matrix.php }} - DB ${{ matrix.DB }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ tools: composer, pecl
+ extensions: imagick, sqlite3, pgsql, mysqli, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, mbstring
+ ini-values: ${{ env.PHP_INI_VALUES }}
+ coverage: xdebug
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+ - name: Install composer dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: PHPUnit Test
+ run: |
+ php -d zend.enable_gc=0 -d date.timezone=UTC -d mbstring.func_overload=7 -d mbstring.internal_encoding=UTF-8 vendor/bin/phpunit --coverage-text --configuration tests/travis/${{ matrix.DB }}.phpunit.xml
+ env:
+ XDEBUG_MODE: coverage
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 8525d5f6c..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-language: php
-dist: trusty
-
-php:
- - 5.4
- - 5.5
- - 5.6
- - 7.0
- - 7.1
- - 7.2
- - 7.3
- - 7.4snapshot
- - nightly
- - hhvm-3.30
-
-env:
- - DB=mysql
- - DB=mysqli
- - DB=pgsql
- - DB=sqlite
- - DB=pdo/mysql
- - DB=pdo/pgsql
- - DB=pdo/sqlite
-
-sudo: false
-
-before_script:
- - sh -c "composer install --dev --no-progress"
- - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi"
- - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi"
- - sh -c "if [ '$DB' = 'mysql' ] || [ '$DB' = 'mysqli' ] || [ '$DB' = 'pdo/mysql' ]; then mysql -e 'create database IF NOT EXISTS ci_test;'; fi"
-
-script: php -d zend.enable_gc=0 -d date.timezone=UTC -d mbstring.func_overload=7 -d mbstring.internal_encoding=UTF-8 vendor/bin/phpunit --coverage-text --configuration tests/travis/$DB.phpunit.xml
-
-matrix:
- allow_failures:
- - php: 7.4snapshot
- - php: nightly
- - php: hhvm-3.30
- exclude:
- - php: hhvm-3.30
- env: DB=pgsql
- - php: hhvm-3.30
- env: DB=pdo/pgsql
- - php: 7.0
- env: DB=mysql
- - php: 7.1
- env: DB=mysql
- - php: 7.2
- env: DB=mysql
- - php: 7.3
- env: DB=mysql
- - php: 7.4snapshot
- env: DB=mysql
- - php: nightly
- env: DB=mysql
-
-branches:
- only:
- - develop
- - 3.0-stable
- - 3.1-stable
- - /^feature\/.+$/
diff --git a/application/config/config.php b/application/config/config.php
index 782b19c74..d66d4fce4 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -62,7 +62,7 @@ $config['uri_protocol'] = 'REQUEST_URI';
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
-| https://codeigniter.com/user_guide/general/urls.html
+| https://codeigniter.com/userguide3/general/urls.html
|
| Note: This option is ignored for CLI requests.
*/
@@ -112,8 +112,8 @@ $config['enable_hooks'] = FALSE;
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
-| https://codeigniter.com/user_guide/general/core_classes.html
-| https://codeigniter.com/user_guide/general/creating_libraries.html
+| https://codeigniter.com/userguide3/general/core_classes.html
+| https://codeigniter.com/userguide3/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
@@ -311,7 +311,7 @@ $config['cache_query_string'] = FALSE;
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
-| https://codeigniter.com/user_guide/libraries/encryption.html
+| https://codeigniter.com/userguide3/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
@@ -329,6 +329,10 @@ $config['encryption_key'] = '';
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
+| 'sess_samesite'
+|
+| Session cookie SameSite attribute: Lax (default), Strict or None
+|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
@@ -369,6 +373,7 @@ $config['encryption_key'] = '';
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
+$config['sess_samesite'] = 'Lax';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
@@ -385,6 +390,7 @@ $config['sess_regenerate_destroy'] = FALSE;
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
+| 'cookie_samesite' = Cookie's samesite attribute (Lax, Strict or None)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
@@ -395,6 +401,7 @@ $config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
+$config['cookie_samesite'] = 'Lax';
/*
|--------------------------------------------------------------------------
diff --git a/application/config/hooks.php b/application/config/hooks.php
index a8f38a5dc..79c5c162f 100644
--- a/application/config/hooks.php
+++ b/application/config/hooks.php
@@ -8,6 +8,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
-| https://codeigniter.com/user_guide/general/hooks.html
+| https://codeigniter.com/userguide3/general/hooks.html
|
*/
diff --git a/application/config/memcached.php b/application/config/memcached.php
index 5c23b39c1..65a149617 100644
--- a/application/config/memcached.php
+++ b/application/config/memcached.php
@@ -7,7 +7,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
-| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
+| See: https://codeigniter.com/userguide3/libraries/caching.html#memcached
|
*/
$config = array(
diff --git a/application/config/mimes.php b/application/config/mimes.php
index 7aa5c9e4e..b2e989fea 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -5,7 +5,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
-| This file contains an array of mime types. It is used by the
+| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
@@ -85,9 +85,11 @@ return array(
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
- 'png' => array('image/png', 'image/x-png'),
+ 'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
+ 'heic' => 'image/heic',
+ 'heif' => 'image/heif',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
@@ -160,7 +162,7 @@ return array(
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'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'),
+ 'svg' => array('image/svg+xml', 'image/svg', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
diff --git a/application/config/profiler.php b/application/config/profiler.php
index 3db22e39c..3436e931e 100644
--- a/application/config/profiler.php
+++ b/application/config/profiler.php
@@ -9,6 +9,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
-| https://codeigniter.com/user_guide/general/profiling.html
+| https://codeigniter.com/userguide3/general/profiling.html
|
*/
diff --git a/application/config/routes.php b/application/config/routes.php
index 8ebf62bfa..4c70d921c 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -19,7 +19,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
| Please see the user guide for complete details:
|
-| https://codeigniter.com/user_guide/general/routing.html
+| https://codeigniter.com/userguide3/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index c866903f6..21251f46f 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -218,5 +218,6 @@ $robots = array(
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
- 'Uptimebot' => 'Uptimebot'
+ 'Uptimebot' => 'Uptimebot',
+ 'UptimeRobot' => 'UptimeRobot'
);
diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php
index 9213c0cf5..5f82771b6 100644
--- a/application/controllers/Welcome.php
+++ b/application/controllers/Welcome.php
@@ -16,7 +16,7 @@ class Welcome extends CI_Controller {
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
- * @see https://codeigniter.com/user_guide/general/urls.html
+ * @see https://codeigniter.com/userguide3/general/urls.html
*/
public function index()
{
diff --git a/build-release.sh b/build-release.sh
index 6b3b31d12..30967fc2e 100755
--- a/build-release.sh
+++ b/build-release.sh
@@ -47,7 +47,7 @@ fi
echo "Running tests ..."
-cd tests/
+php -d zend.enable_gc=0 -d date.timezone=UTC -d mbstring.func_overload=7 -d mbstring.internal_encoding=UTF-8 vendor/bin/phpunit --coverage-text --configuration tests/travis/sqlite.phpunit.xml
phpunit
if [ $? -ne 0 ]
@@ -56,7 +56,6 @@ then
exit 1
fi
-cd ..
cd user_guide_src/
echo ""
diff --git a/composer.json b/composer.json
index 39c7e77c4..f5b4e8db4 100644
--- a/composer.json
+++ b/composer.json
@@ -16,8 +16,20 @@
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
},
+ "scripts": {
+ "test:coverage": [
+ "@putenv XDEBUG_MODE=coverage",
+ "phpunit --color=always --coverage-text --configuration tests/travis/sqlite.phpunit.xml"
+ ],
+ "post-install-cmd": [
+ "sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php"
+ ],
+ "post-update-cmd": [
+ "sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php"
+ ]
+ },
"require-dev": {
- "mikey179/vfsstream": "1.1.*",
- "phpunit/phpunit": "4.* || 5.*"
+ "mikey179/vfsstream": "1.6.*",
+ "phpunit/phpunit": "4.* || 5.* || 9.*"
}
}
diff --git a/contributing.md b/contributing.md
index 8f43c45a6..206784d1f 100644
--- a/contributing.md
+++ b/contributing.md
@@ -19,7 +19,7 @@ for us to maintain quality of the code-base.
### PHP Style
-All code must meet the [Style Guide](https://codeigniter.com/user_guide/general/styleguide.html), which is
+All code must meet the [Style Guide](https://codeigniter.com/userguide3/general/styleguide.html), which is
essentially the [Allman indent style](https://en.wikipedia.org/wiki/Indent_style#Allman_style), underscores and readable operators. This makes certain that all code is the same format as the existing code and means it will be as readable as possible.
### Documentation
diff --git a/index.php b/index.php
index e7aab3b03..8b095a77a 100755
--- a/index.php
+++ b/index.php
@@ -103,7 +103,7 @@ switch (ENVIRONMENT)
* use an absolute (full) server path.
* For more info please see the user guide:
*
- * https://codeigniter.com/user_guide/general/managing_apps.html
+ * https://codeigniter.com/userguide3/general/managing_apps.html
*
* NO TRAILING SLASH!
*/
diff --git a/readme.rst b/readme.rst
index 3e1382fbd..fa6d242e8 100644
--- a/readme.rst
+++ b/readme.rst
@@ -39,7 +39,7 @@ issues, as well as missing features.
Installation
************
-Please see the `installation section <https://codeigniter.com/user_guide/installation/index.html>`_
+Please see the `installation section <https://codeigniter.com/userguide3/installation/index.html>`_
of the CodeIgniter User Guide.
*******
@@ -54,6 +54,7 @@ Resources
*********
- `User Guide <https://codeigniter.com/docs>`_
+- `Contributing Guide <https://github.com/bcit-ci/CodeIgniter/blob/develop/contributing.md>`_
- `Language File Translations <https://github.com/bcit-ci/codeigniter3-translations>`_
- `Community Forums <https://forum.codeigniter.com/>`_
- `Community Wiki <https://github.com/bcit-ci/CodeIgniter/wiki>`_
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index 014220a44..0b48d4d0c 100644
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/benchmark.html
+ * @link https://codeigniter.com/userguide3/libraries/benchmark.html
*/
class CI_Benchmark {
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 9bf60a4ac..704539ef4 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
*/
/**
@@ -383,7 +383,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* ReflectionMethod::isConstructor() is the ONLY reliable check,
* knowing which method will be executed as a constructor.
*/
- elseif ( ! is_callable(array($class, $method)))
+ else
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
diff --git a/system/core/Common.php b/system/core/Common.php
index fadc0a0b1..52cb7114e 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Common Functions
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
*/
// ------------------------------------------------------------------------
@@ -569,7 +569,7 @@ if ( ! function_exists('set_status_header'))
return;
}
- $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
+ $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
}
@@ -782,11 +782,9 @@ if ( ! function_exists('_stringify_attributes'))
*/
function _stringify_attributes($attributes, $js = FALSE)
{
- $atts = NULL;
-
if (empty($attributes))
{
- return $atts;
+ return NULL;
}
if (is_string($attributes))
@@ -796,6 +794,7 @@ if ( ! function_exists('_stringify_attributes'))
$attributes = (array) $attributes;
+ $atts = '';
foreach ($attributes as $key => $val)
{
$atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"';
diff --git a/system/core/Config.php b/system/core/Config.php
index 13cc087d0..e6eb0ad95 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/config.html
+ * @link https://codeigniter.com/userguide3/libraries/config.html
*/
class CI_Config {
diff --git a/system/core/Controller.php b/system/core/Controller.php
index e25b8472c..ac27989f3 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/controllers.html
+ * @link https://codeigniter.com/userguide3/general/controllers.html
*/
class CI_Controller {
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index e8e7f6c29..92c635f97 100644
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Exceptions
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/exceptions.html
+ * @link https://codeigniter.com/userguide3/libraries/exceptions.html
*/
class CI_Exceptions {
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 353e22e21..864c59d25 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/hooks.html
+ * @link https://codeigniter.com/userguide3/general/hooks.html
*/
class CI_Hooks {
diff --git a/system/core/Input.php b/system/core/Input.php
index 053970b01..0beb252ed 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Input
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/input.html
+ * @link https://codeigniter.com/userguide3/libraries/input.html
*/
class CI_Input {
@@ -300,14 +300,15 @@ class CI_Input {
* @param string $prefix Cookie name prefix
* @param bool $secure Whether to only transfer cookies via SSL
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
+ * @param string $samesite SameSite attribute
* @return void
*/
- public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
+ public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
{
if (is_array($name))
{
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
- foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item)
+ foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name', 'samesite') as $item)
{
if (isset($name[$item]))
{
@@ -348,7 +349,47 @@ class CI_Input {
$expire = ($expire > 0) ? time() + $expire : 0;
}
- setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly);
+ isset($samesite) OR $samesite = config_item('cookie_samesite');
+ if (isset($samesite))
+ {
+ $samesite = ucfirst(strtolower($samesite));
+ in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
+ }
+ else
+ {
+ $samesite = 'Lax';
+ }
+
+ if ($samesite === 'None' && ! $secure)
+ {
+ log_message('error', $name.' cookie sent with SameSite=None, but without Secure attribute.');
+ }
+
+ if ( ! is_php('7.3'))
+ {
+ $maxage = $expire - time();
+ if ($maxage < 1)
+ {
+ $maxage = 0;
+ }
+
+ $cookie_header = 'Set-Cookie: '.$prefix.$name.'='.rawurlencode($value);
+ $cookie_header .= ($expire === 0 ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)).'; Max-Age='.$maxage;
+ $cookie_header .= '; Path='.$path.($domain !== '' ? '; Domain='.$domain : '');
+ $cookie_header .= ($secure ? '; Secure' : '').($httponly ? '; HttpOnly' : '').'; SameSite='.$samesite;
+ header($cookie_header);
+ return;
+ }
+
+ $setcookie_options = array(
+ 'expires' => $expire,
+ 'path' => $path,
+ 'domain' => $domain,
+ 'secure' => $secure,
+ 'httponly' => $httponly,
+ 'samesite' => $samesite,
+ );
+ setcookie($prefix.$name, $value, $setcookie_options);
}
// --------------------------------------------------------------------
@@ -508,7 +549,7 @@ class CI_Input {
$which = FILTER_FLAG_IPV6;
break;
default:
- $which = NULL;
+ $which = 0;
break;
}
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 2c8654dcf..5cfeaf37e 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Language
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/language.html
+ * @link https://codeigniter.com/userguide3/libraries/language.html
*/
class CI_Lang {
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 0710b1611..d9a1539aa 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Loader
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/loader.html
+ * @link https://codeigniter.com/userguide3/libraries/loader.html
*/
class CI_Loader {
diff --git a/system/core/Log.php b/system/core/Log.php
index fde0bebf2..9c33f3e98 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Logging
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/errors.html
+ * @link https://codeigniter.com/userguide3/general/errors.html
*/
class CI_Log {
@@ -122,7 +122,7 @@ class CI_Log {
{
$config =& get_config();
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->_log_path = ($config['log_path'] !== '')
? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR;
diff --git a/system/core/Model.php b/system/core/Model.php
index 4c497d21e..585148298 100644
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/config.html
+ * @link https://codeigniter.com/userguide3/libraries/config.html
*/
class CI_Model {
diff --git a/system/core/Output.php b/system/core/Output.php
index f386d3ad4..7f153ef77 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Output
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/output.html
+ * @link https://codeigniter.com/userguide3/libraries/output.html
*/
class CI_Output {
@@ -145,7 +145,7 @@ class CI_Output {
&& extension_loaded('zlib')
);
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
// Get mime types for later
$this->mimes =& get_mimes();
@@ -299,10 +299,14 @@ class CI_Output {
*/
public function get_header($header)
{
- // Combine headers already sent with our batched headers
+ // We only need [x][0] from our multi-dimensional array
+ $header_lines = array_map(function ($headers)
+ {
+ return array_shift($headers);
+ }, $this->headers);
+
$headers = array_merge(
- // We only need [x][0] from our multi-dimensional array
- array_map('array_shift', $this->headers),
+ $header_lines,
headers_list()
);
diff --git a/system/core/Router.php b/system/core/Router.php
index dcdd1ed1f..0d9662559 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/routing.html
+ * @link https://codeigniter.com/userguide3/general/routing.html
*/
class CI_Router {
diff --git a/system/core/Security.php b/system/core/Security.php
index 5edb67f4e..aac308194 100644
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Security
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/security.html
+ * @link https://codeigniter.com/userguide3/libraries/security.html
*/
class CI_Security {
@@ -273,15 +273,35 @@ class CI_Security {
return FALSE;
}
- setcookie(
- $this->_csrf_cookie_name,
- $this->_csrf_hash,
- $expire,
- config_item('cookie_path'),
- config_item('cookie_domain'),
- $secure_cookie,
- config_item('cookie_httponly')
- );
+ if (is_php('7.3'))
+ {
+ setcookie(
+ $this->_csrf_cookie_name,
+ $this->_csrf_hash,
+ array(
+ 'expires' => $expire,
+ 'path' => config_item('cookie_path'),
+ 'domain' => config_item('cookie_domain'),
+ 'secure' => $secure_cookie,
+ 'httponly' => config_item('cookie_httponly'),
+ 'samesite' => 'Strict'
+ )
+ );
+ }
+ else
+ {
+ $domain = trim(config_item('cookie_domain'));
+ header('Set-Cookie: '.$this->_csrf_cookie_name.'='.$this->_csrf_hash
+ .'; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)
+ .'; Max-Age='.$this->_csrf_expire
+ .'; Path='.rawurlencode(config_item('cookie_path'))
+ .($domain === '' ? '' : '; Domain='.$domain)
+ .($secure_cookie ? '; Secure' : '')
+ .(config_item('cookie_httponly') ? '; HttpOnly' : '')
+ .'; SameSite=Strict'
+ );
+ }
+
log_message('info', 'CSRF cookie sent');
return $this;
diff --git a/system/core/URI.php b/system/core/URI.php
index 3670ef29d..9bef22d6c 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category URI
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/uri.html
+ * @link https://codeigniter.com/userguide3/libraries/uri.html
*/
class CI_URI {
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 39954c428..5e18f07bb 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category UTF-8
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/utf8.html
+ * @link https://codeigniter.com/userguide3/libraries/utf8.html
*/
class CI_Utf8 {
diff --git a/system/core/compat/hash.php b/system/core/compat/hash.php
index 8d905ad68..f1829a3a6 100644
--- a/system/core/compat/hash.php
+++ b/system/core/compat/hash.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Compatibility
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
* @link https://secure.php.net/hash
*/
diff --git a/system/core/compat/mbstring.php b/system/core/compat/mbstring.php
index 41c86376c..af73b8cce 100644
--- a/system/core/compat/mbstring.php
+++ b/system/core/compat/mbstring.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Compatibility
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
* @link https://secure.php.net/mbstring
*/
diff --git a/system/core/compat/password.php b/system/core/compat/password.php
index f6517b46d..306300eda 100644
--- a/system/core/compat/password.php
+++ b/system/core/compat/password.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Compatibility
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
* @link https://secure.php.net/password
*/
diff --git a/system/core/compat/standard.php b/system/core/compat/standard.php
index 31c39ca25..21feeb04e 100644
--- a/system/core/compat/standard.php
+++ b/system/core/compat/standard.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Compatibility
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
*/
// ------------------------------------------------------------------------
diff --git a/system/database/DB.php b/system/database/DB.php
index 558212718..c42bb6b91 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*
* @param string|string[] $params
* @param bool $query_builder_override
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index afcfc4cf9..2467a30f2 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_Cache {
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index f3433f849..a213d5cba 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
abstract class CI_DB_driver {
@@ -825,7 +825,7 @@ abstract class CI_DB_driver {
{
return $this->_trans_status;
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index b086f7a81..ce9b30d82 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
abstract class CI_DB_forge {
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 357a2e359..5480ed44f 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
abstract class CI_DB_query_builder extends CI_DB_driver {
@@ -1191,7 +1191,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
/**
* GROUP BY
*
- * @param string $by
+ * @param mixed $by
* @param bool $escape
* @return CI_DB_query_builder
*/
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index ed5252d49..b481de475 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_result {
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index c2edfc9f3..a1450f099 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
abstract class CI_DB_utility {
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index b3b436fed..b133c1025 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author Esen Sagynov
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_cubrid_driver extends CI_DB {
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
index 69b53dd49..8c7cd52db 100644
--- a/system/database/drivers/cubrid/cubrid_forge.php
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author Esen Sagynov
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_cubrid_forge extends CI_DB_forge {
diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php
index 75d702558..988fba6d8 100644
--- a/system/database/drivers/cubrid/cubrid_result.php
+++ b/system/database/drivers/cubrid/cubrid_result.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author Esen Sagynov
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_cubrid_result extends CI_DB_result {
diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php
index ccf794b75..d860bee08 100644
--- a/system/database/drivers/cubrid/cubrid_utility.php
+++ b/system/database/drivers/cubrid/cubrid_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author Esen Sagynov
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_cubrid_utility extends CI_DB_utility {
diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php
index 27e87d427..85badc2fe 100644
--- a/system/database/drivers/ibase/ibase_driver.php
+++ b/system/database/drivers/ibase/ibase_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_ibase_driver extends CI_DB {
diff --git a/system/database/drivers/ibase/ibase_forge.php b/system/database/drivers/ibase/ibase_forge.php
index ad3382042..940080320 100644
--- a/system/database/drivers/ibase/ibase_forge.php
+++ b/system/database/drivers/ibase/ibase_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_ibase_forge extends CI_DB_forge {
diff --git a/system/database/drivers/ibase/ibase_result.php b/system/database/drivers/ibase/ibase_result.php
index 86530973b..c3e4ed7a6 100644
--- a/system/database/drivers/ibase/ibase_result.php
+++ b/system/database/drivers/ibase/ibase_result.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_ibase_result extends CI_DB_result {
diff --git a/system/database/drivers/ibase/ibase_utility.php b/system/database/drivers/ibase/ibase_utility.php
index a80874924..1fc34254e 100644
--- a/system/database/drivers/ibase/ibase_utility.php
+++ b/system/database/drivers/ibase/ibase_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_ibase_utility extends CI_DB_utility {
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 51352e314..a20b01237 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mssql_driver extends CI_DB {
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index 07b93c24d..f79416031 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mssql_forge extends CI_DB_forge {
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index 5d7d3bedc..6cae3050d 100644
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mssql_result extends CI_DB_result {
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 5c9941aca..1aad485b7 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mssql_utility extends CI_DB_utility {
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index bdd80092c..61337cdd3 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysql_driver extends CI_DB {
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index b69aa36b4..e59366bed 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysql_forge extends CI_DB_forge {
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index 842d7d399..461f643df 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysql_result extends CI_DB_result {
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index a54892975..6089da533 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysql_utility extends CI_DB_utility {
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 6553a271f..dc3d0cf48 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysqli_driver extends CI_DB {
@@ -116,6 +116,13 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function db_connect($persistent = FALSE)
{
+ // PHP 8.1 changes default error handling mode from silent to exceptions - reverse that
+ if (is_php('8.1'))
+ {
+ $mysqli_driver = new mysqli_driver();
+ $mysqli_driver->report_mode = MYSQLI_REPORT_OFF;
+ }
+
// Do we have a socket path?
if ($this->hostname[0] === '/')
{
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index 92b1e94d1..b67fe56cb 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysqli_forge extends CI_DB_forge {
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 0856eca4e..7e4e45f39 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysqli_result extends CI_DB_result {
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 606424655..75e35d116 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_mysqli_utility extends CI_DB_utility {
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 31bda5eb5..511ef0e64 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
/**
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index a73899888..7dc7b2ade 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_oci8_forge extends CI_DB_forge {
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 3da49aa76..7fd911e82 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_oci8_result extends CI_DB_result {
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 3a7261c15..a0a9c2c95 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_oci8_utility extends CI_DB_utility {
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 72289bf9f..f02da4d13 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_odbc_driver extends CI_DB_driver {
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index a06ac4b9e..6aff76941 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_odbc_result extends CI_DB_result {
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 614d35096..b2178b684 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_driver extends CI_DB {
@@ -131,6 +131,14 @@ class CI_DB_pdo_driver extends CI_DB {
$this->options[PDO::ATTR_PERSISTENT] = TRUE;
}
+ // From PHP8.0, default PDO::ATTR_ERRMODE is changed
+ // from PDO::ERRMODE_SILENT to PDO::ERRMODE_EXCEPTION
+ // as https://wiki.php.net/rfc/pdo_default_errmode
+ if ( ! isset($this->options[PDO::ATTR_ERRMODE]))
+ {
+ $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT;
+ }
+
try
{
return new PDO($this->dsn, $this->username, $this->password, $this->options);
@@ -326,4 +334,17 @@ class CI_DB_pdo_driver extends CI_DB {
return 'TRUNCATE TABLE '.$table;
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Close DB Connection
+ *
+ * @return void
+ */
+ protected function _close()
+ {
+ $this->result_id = FALSE;
+ $this->conn_id = FALSE;
+ }
+
}
diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php
index b3973da46..f0f56c3f7 100644
--- a/system/database/drivers/pdo/pdo_result.php
+++ b/system/database/drivers/pdo/pdo_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_result extends CI_DB_result {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php b/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php
index 2e39bb236..63f6f84b5 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_4d_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php b/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php
index 306150b9a..f7fa54316 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_4d_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
index 9a6b643fc..05887bcfb 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php
index f2ee3f5ea..32ccc8cca 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_cubrid_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php
index 09dbdf08f..06f03ccce 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php
index f38ac99ba..692b76d89 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_dblib_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php
index 2c49f1216..4e4dd27e1 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_firebird_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php
index db7936631..c3d25b6f6 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php b/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php
index 00654d7c0..16b1c6e11 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_ibm_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php b/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php
index 99d75b645..8ea4838db 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_ibm_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php b/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php
index 114eb7470..98f463895 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_informix_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php b/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php
index 1f4bcd1af..91a935908 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_informix_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
index 73b88bcfd..0f53e3192 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
index 01595a603..7713f6732 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php
index 41f7a6485..82f0145ba 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
index aa78461df..0700d6369 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
index 93a6420e5..2522debec 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
index 2d0c74b2e..f6241136d 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
@@ -255,7 +255,7 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
{
return 'SELECT "column_name"
FROM "information_schema"."columns"
- WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
+ WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
}
// --------------------------------------------------------------------
@@ -270,7 +270,7 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
{
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
FROM "information_schema"."columns"
- WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
+ WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
if (($query = $this->query($sql)) === FALSE)
{
diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
index 4e19e9c57..4c3a5aaea 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
@@ -54,6 +54,13 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
protected $_drop_table_if = 'DROP TABLE IF EXISTS';
/**
+ * CREATE TABLE IF statement
+ *
+ * @var string
+ */
+ protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS';
+
+ /**
* UNSIGNED support
*
* @var array
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
index f55d9a6c7..634b837c9 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php
index 545b2a3d8..fd9696fb8 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_sqlite_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php
index 84109ae30..1c83593df 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver {
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php
index b23c6d44e..22375949a 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_pdo_sqlsrv_forge extends CI_DB_pdo_forge {
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 19a09490c..22638f901 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_driver extends CI_DB {
@@ -78,22 +78,12 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Class constructor
+ * Build DSN
*
- * Creates a DSN string to be used for db_connect() and db_pconnect()
- *
- * @param array $params
* @return void
*/
- public function __construct($params)
+ protected function _build_dsn()
{
- parent::__construct($params);
-
- if ( ! empty($this->dsn))
- {
- return;
- }
-
$this->dsn === '' OR $this->dsn = '';
if (strpos($this->hostname, '/') !== FALSE)
@@ -145,10 +135,11 @@ class CI_DB_postgre_driver extends CI_DB {
* Database connection
*
* @param bool $persistent
- * @return resource
+ * @return resource|object
*/
public function db_connect($persistent = FALSE)
{
+ empty($this->dsn) && $this->_build_dsn();
$this->conn_id = ($persistent === TRUE)
? pg_pconnect($this->dsn)
: pg_connect($this->dsn);
@@ -229,7 +220,7 @@ class CI_DB_postgre_driver extends CI_DB {
* Execute the query
*
* @param string $sql an SQL query
- * @return resource
+ * @return resource|object
*/
protected function _execute($sql)
{
@@ -422,7 +413,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
return 'SELECT "column_name"
FROM "information_schema"."columns"
- WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
+ WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
}
// --------------------------------------------------------------------
@@ -437,7 +428,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
FROM "information_schema"."columns"
- WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
+ WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
if (($query = $this->query($sql)) === FALSE)
{
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index a378d146b..6f214c665 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_forge extends CI_DB_forge {
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index b0054ddae..d977a60e3 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_result extends CI_DB_result {
@@ -126,7 +126,7 @@ class CI_DB_postgre_result extends CI_DB_result {
*/
public function free_result()
{
- if (is_resource($this->result_id))
+ if ($this->result_id !== FALSE)
{
pg_free_result($this->result_id);
$this->result_id = FALSE;
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 450aa36e4..e6e7b28ba 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_utility extends CI_DB_utility {
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php
index 5d057ba5a..d456250f2 100644
--- a/system/database/drivers/sqlite3/sqlite3_driver.php
+++ b/system/database/drivers/sqlite3/sqlite3_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlite3_driver extends CI_DB {
diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php
index 4019a9523..52894e857 100644
--- a/system/database/drivers/sqlite3/sqlite3_forge.php
+++ b/system/database/drivers/sqlite3/sqlite3_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlite3_forge extends CI_DB_forge {
diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php
index d656fed12..a48cbcf56 100644
--- a/system/database/drivers/sqlite3/sqlite3_result.php
+++ b/system/database/drivers/sqlite3/sqlite3_result.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlite3_result extends CI_DB_result {
diff --git a/system/database/drivers/sqlite3/sqlite3_utility.php b/system/database/drivers/sqlite3/sqlite3_utility.php
index 1bdf3ae37..c80dd4f97 100644
--- a/system/database/drivers/sqlite3/sqlite3_utility.php
+++ b/system/database/drivers/sqlite3/sqlite3_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlite3_utility extends CI_DB_utility {
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index a22a8b316..33f971ff4 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlsrv_driver extends CI_DB {
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index 90c3120a5..610d2e426 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlsrv_forge extends CI_DB_forge {
diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php
index e2649c666..bf5884429 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_result.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_result.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlsrv_result extends CI_DB_result {
diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php
index 6dd01a990..bb2a67806 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_utility.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php
@@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_sqlsrv_utility extends CI_DB_utility {
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index cb7eca68b..2c359240a 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/array_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/array_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index dcd6882c8..6fce05267 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/captcha_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/captcha_helper.html
*/
// ------------------------------------------------------------------------
@@ -69,6 +69,7 @@ if ( ! function_exists('create_captcha'))
'img_width' => '150',
'img_height' => '30',
'img_alt' => 'captcha',
+ 'img_class' => '',
'font_path' => '',
'font_size' => 16,
'expiration' => 7200,
@@ -372,7 +373,10 @@ if ( ! function_exists('create_captcha'))
$img_src = 'data:image/png;base64,'.base64_encode($img_src);
}
- $img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_src.'" style="width: '.$img_width.'px; height: '.$img_height .'px; border: 0;" alt="'.$img_alt.'" />';
+ $img_class = trim($img_class);
+ $img_class = (bool) strlen($img_class) ? 'class="'.$img_class.'" ' : '';
+
+ $img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_src.'" style="width: '.$img_width.'px; height: '.$img_height .'px; border: 0;" '.$img_class.'alt="'.$img_alt.'" />';
ImageDestroy($im);
return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename);
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index d9724932e..8183e0541 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/cookie_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/cookie_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 6ee3c3119..db9e9642d 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/date_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/date_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 73777bfb5..4732db57b 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/directory_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/directory_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 4d7829640..9bdeea13d 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/download_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/download_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index ebc863bbc..398d11afd 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/file_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/file_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 7a2dadaf3..4b88d3b12 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/form_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/form_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 8b06e4406..531ae2251 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/html_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/html_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index a36836b00..b7f472bcc 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/inflector_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/inflector_helper.html
*/
// --------------------------------------------------------------------
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index 2cefcc277..dff6a6b24 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/language_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/language_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 15a53ff72..55fa1e5a0 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/number_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/number_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index 543e4c078..47d10c2f5 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/path_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/path_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index dcf5b8b58..f6dbafec9 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/security_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/security_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 7738bf97f..3a05525db 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/string_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/string_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index e1c5e246e..5d5a958e2 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/text_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/text_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index d308a57d5..47617ffb2 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/typography_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/typography_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 6a959f0e6..4c060a203 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/url_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/url_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 2639956fe..f83f3f544 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/helpers/xml_helper.html
+ * @link https://codeigniter.com/userguide3/helpers/xml_helper.html
*/
// ------------------------------------------------------------------------
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index a6bdae50a..fcfcf62ca 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/calendar.html
+ * @link https://codeigniter.com/userguide3/libraries/calendar.html
*/
class CI_Calendar {
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 1912e0442..b01e44a63 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/email.html
+ * @link https://codeigniter.com/userguide3/libraries/email.html
*/
class CI_Email {
@@ -389,7 +389,7 @@ class CI_Email {
$this->charset = config_item('charset');
$this->initialize($config);
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
log_message('info', 'Email Class Initialized');
}
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 7ed185f1b..df1af4cf4 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/encryption.html
+ * @link https://codeigniter.com/userguide3/libraries/encryption.html
*/
class CI_Encrypt {
@@ -198,7 +198,7 @@ class CI_Encrypt {
* This allows for backwards compatibility and a method to transition to the
* new encryption algorithms.
*
- * For more details, see https://codeigniter.com/user_guide/installation/upgrade_200.html#encryption
+ * For more details, see https://codeigniter.com/userguide3/installation/upgrade_200.html#encryption
*
* @param string
* @param int (mcrypt mode constant)
diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php
index fd858cb29..7d648dfa3 100644
--- a/system/libraries/Encryption.php
+++ b/system/libraries/Encryption.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/encryption.html
+ * @link https://codeigniter.com/userguide3/libraries/encryption.html
*/
class CI_Encryption {
@@ -161,7 +161,7 @@ class CI_Encryption {
show_error('Encryption: Unable to find an available encryption driver.');
}
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->initialize($params);
if ( ! isset($this->_key) && self::strlen($key = config_item('encryption_key')) > 0)
@@ -476,7 +476,7 @@ class CI_Encryption {
$iv = ($iv_size = openssl_cipher_iv_length($params['handle']))
? $this->create_key($iv_size)
- : NULL;
+ : '';
$data = openssl_encrypt(
$data,
@@ -585,7 +585,7 @@ class CI_Encryption {
}
else
{
- $iv = NULL;
+ $iv = '';
}
if (mcrypt_generic_init($params['handle'], $params['key'], $iv) < 0)
@@ -632,7 +632,7 @@ class CI_Encryption {
}
else
{
- $iv = NULL;
+ $iv = '';
}
return empty($params['handle'])
@@ -910,8 +910,8 @@ class CI_Encryption {
protected static function strlen($str)
{
return (self::$func_overload)
- ? mb_strlen($str, '8bit')
- : strlen($str);
+ ? mb_strlen((string) $str, '8bit')
+ : strlen((string) $str);
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index de59ef9f7..043a97c6d 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Validation
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/form_validation.html
+ * @link https://codeigniter.com/userguide3/libraries/form_validation.html
*/
class CI_Form_validation {
@@ -1062,7 +1062,7 @@ class CI_Form_validation {
{
return is_array($str)
? (empty($str) === FALSE)
- : (trim($str) !== '');
+ : (trim((string) $str) !== '');
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 4f0f5dfb3..92644153a 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/ftp.html
+ * @link https://codeigniter.com/userguide3/libraries/ftp.html
*/
class CI_FTP {
@@ -202,7 +202,7 @@ class CI_FTP {
*/
protected function _is_conn()
{
- if ( ! is_resource($this->conn_id))
+ if ($this->conn_id !== FALSE)
{
if ($this->debug === TRUE)
{
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 0d9fa4420..6aeee1790 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Image_lib
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/image_lib.html
+ * @link https://codeigniter.com/userguide3/libraries/image_lib.html
*/
class CI_Image_lib {
@@ -1474,15 +1474,16 @@ class CI_Image_lib {
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
return FALSE;
}
+
+ return imagecreatefrompng($path);
case 18:
if ( ! function_exists('imagecreatefromwebp'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported'));
return FALSE;
}
- return imagecreatefromwebp($path);
- return imagecreatefrompng($path);
+ return imagecreatefromwebp($path);
default:
$this->set_error(array('imglib_unsupported_imagecreate'));
return FALSE;
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index 1b7808923..915d4e453 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -288,7 +288,7 @@ class CI_Migration {
$this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class);
return FALSE;
}
- elseif ( ! is_callable(array($class, $method)))
+ elseif ( ! method_exists($class, $method) OR ! (new ReflectionMethod($class, $method))->isPublic())
{
$this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);
return FALSE;
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 11d63fe50..20418c00a 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Pagination
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/pagination.html
+ * @link https://codeigniter.com/userguide3/libraries/pagination.html
*/
class CI_Pagination {
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index d3c6500ae..04476f1a2 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Parser
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/parser.html
+ * @link https://codeigniter.com/userguide3/libraries/parser.html
*/
class CI_Parser {
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index e3c4bd10a..5531f3366 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -50,7 +50,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/profiling.html
+ * @link https://codeigniter.com/userguide3/general/profiling.html
*/
class CI_Profiler {
diff --git a/system/libraries/Session/CI_Session_driver_interface.php b/system/libraries/Session/CI_Session_driver_interface.php
new file mode 100644
index 000000000..a854e92af
--- /dev/null
+++ b/system/libraries/Session/CI_Session_driver_interface.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP
+ *
+ * This content is released under the MIT License (MIT)
+ *
+ * Copyright (c) 2022, CodeIgniter Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 3.0.0
+ * @filesource
+ */
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+/**
+ * CI_Session_driver_interface
+ *
+ * A compatibility typeless SessionHandlerInterface alias
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Sessions
+ * @author Andrey Andreev
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
+ */
+interface CI_Session_driver_interface {
+
+ public function open($save_path, $name);
+ public function close();
+ public function read($session_id);
+ public function write($session_id, $session_data);
+ public function destroy($session_id);
+ public function gc($maxlifetime);
+}
diff --git a/system/libraries/Session/OldSessionWrapper.php b/system/libraries/Session/OldSessionWrapper.php
new file mode 100644
index 000000000..5934b5218
--- /dev/null
+++ b/system/libraries/Session/OldSessionWrapper.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP
+ *
+ * This content is released under the MIT License (MIT)
+ *
+ * Copyright (c) 2022, CodeIgniter Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 3.0.0
+ * @filesource
+ */
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+/**
+ * OldSessionWrapper
+ *
+ * PHP 8 Session handler compatibility wrapper, pre-PHP8 version
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Sessions
+ * @author Andrey Andreev
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
+ */
+class CI_SessionWrapper implements SessionHandlerInterface {
+
+ protected CI_Session_driver_interface $driver;
+
+ public function __construct(CI_Session_driver_interface $driver)
+ {
+ $this->driver = $driver;
+ }
+
+ public function open($save_path, $name)
+ {
+ return $this->driver->open($save_path, $name);
+ }
+
+ public function close()
+ {
+ return $this->driver->close();
+ }
+
+ public function read($id)
+ {
+ return $this->driver->read($id);
+ }
+
+ public function write($id, $data)
+ {
+ return $this->driver->write($id, $data);
+ }
+
+ public function destroy($id)
+ {
+ return $this->driver->destroy($id);
+ }
+
+ public function gc($maxlifetime)
+ {
+ return $this->driver->gc($maxlifetime);
+ }
+}
diff --git a/system/libraries/Session/PHP8SessionWrapper.php b/system/libraries/Session/PHP8SessionWrapper.php
new file mode 100644
index 000000000..c6dfaf7e0
--- /dev/null
+++ b/system/libraries/Session/PHP8SessionWrapper.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP
+ *
+ * This content is released under the MIT License (MIT)
+ *
+ * Copyright (c) 2022, CodeIgniter Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license http://opensource.org/licenses/MIT MIT License
+ * @link https://codeigniter.com
+ * @since Version 3.0.0
+ * @filesource
+ */
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+/**
+ * PHP8SessionWrapper
+ *
+ * PHP 8 Session handler compatibility wrapper
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Sessions
+ * @author Andrey Andreev
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
+ */
+class CI_SessionWrapper implements SessionHandlerInterface {
+
+ protected CI_Session_driver_interface $driver;
+
+ public function __construct(CI_Session_driver_interface $driver)
+ {
+ $this->driver = $driver;
+ }
+
+ public function open(string $save_path, string $name): bool
+ {
+ return $this->driver->open($save_path, $name);
+ }
+
+ public function close(): bool
+ {
+ return $this->driver->close();
+ }
+
+ #[\ReturnTypeWillChange]
+ public function read(string $id): mixed
+ {
+ return $this->driver->read($id);
+ }
+
+ public function write(string $id, string $data): bool
+ {
+ return $this->driver->write($id, $data);
+ }
+
+ public function destroy(string $id): bool
+ {
+ return $this->driver->destroy($id);
+ }
+
+ #[\ReturnTypeWillChange]
+ public function gc(int $maxlifetime): mixed
+ {
+ return $this->driver->gc($maxlifetime);
+ }
+}
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index dfd0f432e..f370f7f19 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 2.0.0
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Sessions
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/sessions.html
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
class CI_Session {
@@ -102,15 +103,24 @@ class CI_Session {
$this->_configure($params);
$this->_config['_sid_regexp'] = $this->_sid_regexp;
- $class = new $class($this->_config);
- if ($class instanceof SessionHandlerInterface)
+ $class = new $class($this->_config);
+ $wrapper = new CI_SessionWrapper($class);
+ if (is_php('5.4'))
{
session_set_save_handler($class, TRUE);
}
else
{
- log_message('error', "Session: Driver '".$this->_driver."' doesn't implement SessionHandlerInterface. Aborting.");
- return;
+ session_set_save_handler(
+ array($class, 'open'),
+ array($class, 'close'),
+ array($class, 'read'),
+ array($class, 'write'),
+ array($class, 'destroy'),
+ array($class, 'gc')
+ );
+
+ register_shutdown_function('session_write_close');
}
// Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
@@ -144,15 +154,36 @@ class CI_Session {
// unless it is being currently created or regenerated
elseif (isset($_COOKIE[$this->_config['cookie_name']]) && $_COOKIE[$this->_config['cookie_name']] === session_id())
{
- setcookie(
- $this->_config['cookie_name'],
- session_id(),
- (empty($this->_config['cookie_lifetime']) ? 0 : time() + $this->_config['cookie_lifetime']),
- $this->_config['cookie_path'],
- $this->_config['cookie_domain'],
- $this->_config['cookie_secure'],
- TRUE
- );
+ $expires = empty($this->_config['cookie_lifetime']) ? 0 : time() + $this->_config['cookie_lifetime'];
+ if (is_php('7.3'))
+ {
+ setcookie(
+ $this->_config['cookie_name'],
+ session_id(),
+ array(
+ 'expires' => $expires,
+ 'path' => $this->_config['cookie_path'],
+ 'domain' => $this->_config['cookie_domain'],
+ 'secure' => $this->_config['cookie_secure'],
+ 'httponly' => TRUE,
+ 'samesite' => $this->_config['cookie_samesite']
+ )
+ );
+ }
+ else
+ {
+ $header = 'Set-Cookie: '.$this->_config['cookie_name'].'='.session_id();
+ $header .= empty($expires) ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expires).'; Max-Age='.$this->_config['cookie_lifetime'];
+ $header .= '; Path='.$this->_config['cookie_path'];
+ $header .= ($this->_config['cookie_domain'] !== '' ? '; Domain='.$this->_config['cookie_domain'] : '');
+ $header .= ($this->_config['cookie_secure'] ? '; Secure' : '').'; HttpOnly; SameSite='.$this->_config['cookie_samesite'];
+ header($header);
+ }
+
+ if ( ! $this->_config['cookie_secure'] && $this->_config['cookie_samesite'] === 'None')
+ {
+ log_message('error', 'Session:', $this->_config['cookie_name'].' cookie sent with SameSite=None, but without Secure attribute.');
+ }
}
$this->_ci_init_vars();
@@ -174,6 +205,10 @@ class CI_Session {
*/
protected function _ci_load_classes($driver)
{
+ require_once(BASEPATH.'libraries/Session/CI_Session_driver_interface.php');
+ $wrapper = is_php('8.0') ? 'PHP8SessionWrapper' : 'OldSessionWrapper';
+ require_once(BASEPATH.'libraries/Session/'.$wrapper.'.php');
+
$prefix = config_item('subclass_prefix');
if ( ! class_exists('CI_Session_driver', FALSE))
@@ -267,13 +302,43 @@ class CI_Session {
isset($params['cookie_domain']) OR $params['cookie_domain'] = config_item('cookie_domain');
isset($params['cookie_secure']) OR $params['cookie_secure'] = (bool) config_item('cookie_secure');
- session_set_cookie_params(
- $params['cookie_lifetime'],
- $params['cookie_path'],
- $params['cookie_domain'],
- $params['cookie_secure'],
- TRUE // HttpOnly; Yes, this is intentional and not configurable for security reasons
- );
+ isset($params['cookie_samesite']) OR $params['cookie_samesite'] = config_item('sess_samesite');
+ if ( ! isset($params['cookie_samesite']) && is_php('7.3'))
+ {
+ $params['cookie_samesite'] = ini_get('session.cookie_samesite');
+ }
+
+ if (isset($params['cookie_samesite']))
+ {
+ $params['cookie_samesite'] = ucfirst(strtolower($params['cookie_samesite']));
+ in_array($params['cookie_samesite'], array('Lax', 'Strict', 'None'), TRUE) OR $params['cookie_samesite'] = 'Lax';
+ }
+ else
+ {
+ $params['cookie_samesite'] = 'Lax';
+ }
+
+ if (is_php('7.3'))
+ {
+ session_set_cookie_params(array(
+ 'lifetime' => $params['cookie_lifetime'],
+ 'path' => $params['cookie_path'],
+ 'domain' => $params['cookie_domain'],
+ 'secure' => $params['cookie_secure'],
+ 'httponly' => $params['cookie_httponly'],
+ 'samesite' => $params['cookie_samesite']
+ ));
+ }
+ else
+ {
+ session_set_cookie_params(
+ $params['cookie_lifetime'],
+ $params['cookie_path'],
+ $params['cookie_domain'],
+ $params['cookie_secure'],
+ TRUE // HttpOnly; Yes, this is intentional and not configurable for security reasons
+ );
+ }
if (empty($expiration))
{
@@ -396,9 +461,7 @@ class CI_Session {
{
$_SESSION['__ci_vars'][$key] = 'old';
}
- // Hacky, but 'old' will (implicitly) always be less than time() ;)
- // DO NOT move this above the 'new' check!
- elseif ($value < $current_time)
+ elseif ($value === 'old' || $value < $current_time)
{
unset($_SESSION[$key], $_SESSION['__ci_vars'][$key]);
}
@@ -706,7 +769,7 @@ class CI_Session {
*
* Legacy CI_Session compatibility method
*
- * @returns array
+ * @return array
*/
public function &get_userdata()
{
diff --git a/system/libraries/Session/Session_driver.php b/system/libraries/Session/Session_driver.php
index dbc833739..b1b1b073e 100644
--- a/system/libraries/Session/Session_driver.php
+++ b/system/libraries/Session/Session_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -44,9 +45,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Sessions
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/sessions.html
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-abstract class CI_Session_driver implements SessionHandlerInterface {
+abstract class CI_Session_driver {
protected $_config;
@@ -139,14 +140,28 @@ abstract class CI_Session_driver implements SessionHandlerInterface {
*/
protected function _cookie_destroy()
{
+ if ( ! is_php('7.3'))
+ {
+ $header = 'Set-Cookie: '.$this->_config['cookie_name'].'=';
+ $header .= '; Expires='.gmdate('D, d-M-Y H:i:s T', 1).'; Max-Age=-1';
+ $header .= '; Path='.$this->_config['cookie_path'];
+ $header .= ($this->_config['cookie_domain'] !== '' ? '; Domain='.$this->_config['cookie_domain'] : '');
+ $header .= ($this->_config['cookie_secure'] ? '; Secure' : '').'; HttpOnly; SameSite='.$this->_config['cookie_samesite'];
+ header($header);
+ return;
+ }
+
return setcookie(
$this->_config['cookie_name'],
NULL,
- 1,
- $this->_config['cookie_path'],
- $this->_config['cookie_domain'],
- $this->_config['cookie_secure'],
- TRUE
+ array(
+ 'expires' => 1,
+ 'path' => $this->_config['cookie_path'],
+ 'domain' => $this->_config['cookie_domain'],
+ 'secure' => $this->_config['cookie_secure'],
+ 'httponly' => TRUE,
+ 'samesite' => $this->_config['cookie_samesite']
+ )
);
}
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index 89afe3455..2f788a1a1 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -44,9 +45,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Sessions
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/sessions.html
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_database_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_database_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* DB object
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index d9966273b..4b7b9878b 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -44,9 +45,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Sessions
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/sessions.html
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_files_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_files_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* Save path
@@ -115,7 +116,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
$this->_sid_regexp = $this->_config['_sid_regexp'];
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index 854adf821..d84a9df1d 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -44,9 +45,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Sessions
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/sessions.html
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_memcached_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_memcached_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* Memcached instance
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 1bbb13db5..fae024bee 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2019, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 3.0.0
@@ -44,9 +45,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Sessions
* @author Andrey Andreev
- * @link https://codeigniter.com/user_guide/libraries/sessions.html
+ * @link https://codeigniter.com/userguide3/libraries/sessions.html
*/
-class CI_Session_redis_driver extends CI_Session_driver implements SessionHandlerInterface {
+class CI_Session_redis_driver extends CI_Session_driver implements CI_Session_driver_interface {
/**
* phpRedis instance
@@ -137,7 +138,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
{
$save_path = array('path' => $matches[1]);
}
- elseif (preg_match('#(?:tcp://)?([^:?]+)(?:\:(\d+))?(?<options>\?.+)?#', $this->_config['save_path'], $matches))
+ elseif (preg_match('#(?:(?:tcp|tls)://)?([^:?]+)(?:\:(\d+))?(?<options>\?.+)?#', $this->_config['save_path'], $matches))
{
$save_path = array(
'host' => $matches[1],
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 055512698..98258b63d 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category HTML Tables
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/table.html
+ * @link https://codeigniter.com/userguide3/libraries/table.html
*/
class CI_Table {
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index 07f066d01..75ccae8f8 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Trackbacks
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/trackback.html
+ * @link https://codeigniter.com/userguide3/libraries/trackback.html
*/
class CI_Trackback {
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index e67138c1a..d919d484a 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Helpers
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/typography.html
+ * @link https://codeigniter.com/userguide3/libraries/typography.html
*/
class CI_Typography {
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index 631d583ba..55e3bfcb2 100644
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category UnitTesting
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/unit_testing.html
+ * @link https://codeigniter.com/userguide3/libraries/unit_testing.html
*/
class CI_Unit_test {
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 95f765b78..281ebef1a 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Uploads
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/file_uploading.html
+ * @link https://codeigniter.com/userguide3/libraries/file_uploading.html
*/
class CI_Upload {
@@ -1227,7 +1227,7 @@ class CI_Upload {
if (function_exists('finfo_file'))
{
$finfo = @finfo_open(FILEINFO_MIME);
- if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
+ if ($finfo !== FALSE) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
{
$mime = @finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index a70511fc3..c144db7a8 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category User Agent
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/user_agent.html
+ * @link https://codeigniter.com/userguide3/libraries/user_agent.html
*/
class CI_User_agent {
@@ -498,7 +498,7 @@ class CI_User_agent {
else
{
$referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
- $own_host = parse_url(config_item('base_url'), PHP_URL_HOST);
+ $own_host = parse_url((string) config_item('base_url'), PHP_URL_HOST);
$this->referer = ($referer_host && $referer_host !== $own_host);
}
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 4e8c303c7..11d4400fe 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -51,7 +51,7 @@ if ( ! function_exists('xml_parser_create'))
* @subpackage Libraries
* @category XML-RPC
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/xmlrpc.html
+ * @link https://codeigniter.com/userguide3/libraries/xmlrpc.html
*/
class CI_Xmlrpc {
@@ -559,7 +559,7 @@ class CI_Xmlrpc {
*
* @category XML-RPC
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/xmlrpc.html
+ * @link https://codeigniter.com/userguide3/libraries/xmlrpc.html
*/
class XML_RPC_Client extends CI_Xmlrpc
{
@@ -780,7 +780,7 @@ class XML_RPC_Client extends CI_Xmlrpc
*
* @category XML-RPC
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/xmlrpc.html
+ * @link https://codeigniter.com/userguide3/libraries/xmlrpc.html
*/
class XML_RPC_Response
{
@@ -1028,7 +1028,7 @@ class XML_RPC_Response
*
* @category XML-RPC
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/xmlrpc.html
+ * @link https://codeigniter.com/userguide3/libraries/xmlrpc.html
*/
class XML_RPC_Message extends CI_Xmlrpc
{
@@ -1647,7 +1647,7 @@ class XML_RPC_Message extends CI_Xmlrpc
*
* @category XML-RPC
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/xmlrpc.html
+ * @link https://codeigniter.com/userguide3/libraries/xmlrpc.html
*/
class XML_RPC_Values extends CI_Xmlrpc
{
@@ -1912,7 +1912,7 @@ class XML_RPC_Values extends CI_Xmlrpc
*/
public function iso8601_encode($time, $utc = FALSE)
{
- return ($utc) ? strftime('%Y%m%dT%H:%i:%s', $time) : gmstrftime('%Y%m%dT%H:%i:%s', $time);
+ return ($utc) ? date('Ymd\TH:i:s', $time) : gmdate('Ymd\TH:i:s', $time);
}
} // END XML_RPC_Values Class
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index e70b80397..e20bf4836 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -56,7 +56,7 @@ if ( ! class_exists('CI_Xmlrpc', FALSE))
* @subpackage Libraries
* @category XML-RPC
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/xmlrpc.html
+ * @link https://codeigniter.com/userguide3/libraries/xmlrpc.html
*/
class CI_Xmlrpcs extends CI_Xmlrpc {
@@ -348,7 +348,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc {
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
}
}
- elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1])))
+ elseif (($objectCall && ( ! method_exists($method_parts[0], $method_parts[1]) OR ! (new ReflectionMethod($method_parts[0], $method_parts[1]))->isPublic()))
OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function']))
)
{
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 4579e8c2b..f744493a9 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -50,7 +50,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Encryption
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/zip.html
+ * @link https://codeigniter.com/userguide3/libraries/zip.html
*/
class CI_Zip {
@@ -119,7 +119,7 @@ class CI_Zip {
*/
public function __construct()
{
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->now = time();
log_message('info', 'Zip Compression Class Initialized');
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index b4e56bdae..ada6a5998 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -65,6 +65,13 @@ else
is_php('5.6') && ini_set('php.internal_encoding', 'UTF-8');
+if (is_php('7.0'))
+{
+ $test_case_code = file_get_contents(PROJECT_BASE.'vendor/phpunit/phpunit/src/Framework/TestCase.php');
+ $test_case_code = preg_replace('/^\s+((?:protected|public)(?: static)? function \w+\(\)): void/m', '$1', $test_case_code);
+ file_put_contents(PROJECT_BASE.'vendor/phpunit/phpunit/src/Framework/TestCase.php', $test_case_code);
+}
+
include_once SYSTEM_PATH.'core/compat/mbstring.php';
include_once SYSTEM_PATH.'core/compat/hash.php';
include_once SYSTEM_PATH.'core/compat/password.php';
diff --git a/tests/codeigniter/Setup_test.php b/tests/codeigniter/Setup_test.php
index 5317c56c7..43545822a 100644
--- a/tests/codeigniter/Setup_test.php
+++ b/tests/codeigniter/Setup_test.php
@@ -1,6 +1,6 @@
<?php
-class Setup_test extends PHPUnit_Framework_TestCase {
+class Setup_test extends \PHPUnit\Framework\TestCase {
public function test_bootstrap_constants()
{
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index 07a99e136..93d1b7118 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -18,6 +18,14 @@ class Input_test extends CI_TestCase {
// --------------------------------------------------------------------
+ public function tear_down()
+ {
+ $_POST = [];
+ $_GET = [];
+ }
+
+ // --------------------------------------------------------------------
+
public function test_get_not_exists()
{
$this->assertSame(array(), $this->input->get());
@@ -93,7 +101,7 @@ class Input_test extends CI_TestCase {
public function test_post_get_array_notation()
{
$_SERVER['REQUEST_METHOD'] = 'POST';
- $_POST['foo']['bar'] = 'baz';
+ $_POST['foo'] = array('bar' => 'baz');
$barArray = array('bar' => 'baz');
$this->assertEquals('baz', $this->input->get_post('foo[bar]'));
@@ -120,7 +128,7 @@ class Input_test extends CI_TestCase {
public function test_get_post_array_notation()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_GET['foo']['bar'] = 'baz';
+ $_GET['foo'] = array('bar' => 'baz');
$barArray = array('bar' => 'baz');
$this->assertEquals('baz', $this->input->get_post('foo[bar]'));
@@ -169,7 +177,7 @@ class Input_test extends CI_TestCase {
$this->assertEquals("Hello, i try to [removed]alert&#40;'Hack'&#41;;[removed] your site", $harmless);
$_SERVER['REQUEST_METHOD'] = 'POST';
- $_POST['foo']['bar'] = 'baz';
+ $_POST['foo'] = array('bar' => 'baz');
$barArray = array('bar' => 'baz');
$this->assertEquals('baz', $this->input->post('foo[bar]'));
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php
index df698f30c..4fa6d6869 100644
--- a/tests/codeigniter/core/Loader_test.php
+++ b/tests/codeigniter/core/Loader_test.php
@@ -36,7 +36,8 @@ class Loader_test extends CI_TestCase {
// Test loading as an array.
$this->assertInstanceOf('CI_Loader', $this->load->library(array($lib)));
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $lib, $this->ci_obj);
+ $this->assertObjectHasAttribute($lib, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$lib);
// Create library in VFS
$lib = array('unit_test_lib' => 'unit_test_lib');
@@ -87,14 +88,16 @@ class Loader_test extends CI_TestCase {
$this->assertInstanceOf('CI_Loader', $this->load->library($lib));
$this->assertTrue(class_exists($class), $class.' does not exist');
$this->assertTrue(class_exists($ext), $ext.' does not exist');
- $this->assertAttributeInstanceOf($class, $name, $this->ci_obj);
- $this->assertAttributeInstanceOf($ext, $name, $this->ci_obj);
+ $this->assertObjectHasAttribute($name, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$name);
+ $this->assertInstanceOf($ext, $this->ci_obj->$name);
// Test reloading with object name
$obj = 'exttest';
$this->assertInstanceOf('CI_Loader', $this->load->library($lib, NULL, $obj));
- $this->assertAttributeInstanceOf($class, $obj, $this->ci_obj);
- $this->assertAttributeInstanceOf($ext, $obj, $this->ci_obj);
+ $this->assertObjectHasAttribute($obj, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$obj);
+ $this->assertInstanceOf($ext, $this->ci_obj->$obj);
// Test reloading
unset($this->ci_obj->$name);
@@ -137,7 +140,8 @@ class Loader_test extends CI_TestCase {
$obj = 'testy';
$this->assertInstanceOf('CI_Loader', $this->load->library($lib, NULL, $obj));
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $obj, $this->ci_obj);
+ $this->assertObjectHasAttribute($obj, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$obj);
$this->assertEquals($cfg, $this->ci_obj->$obj->config);
// Test is_loaded
@@ -168,7 +172,8 @@ class Loader_test extends CI_TestCase {
// Was the model class instantiated.
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $lib, $this->ci_obj);
+ $this->assertObjectHasAttribute($lib, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$lib);
}
// --------------------------------------------------------------------
@@ -188,12 +193,14 @@ class Loader_test extends CI_TestCase {
// Test loading as an array.
$this->assertInstanceOf('CI_Loader', $this->load->driver(array($driver)));
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $driver, $this->ci_obj);
+ $this->assertObjectHasAttribute($driver, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$driver);
// Test loading as a library with a name
$obj = 'testdrive';
$this->assertInstanceOf('CI_Loader', $this->load->library($driver, NULL, $obj));
- $this->assertAttributeInstanceOf($class, $obj, $this->ci_obj);
+ $this->assertObjectHasAttribute($obj, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$obj);
// Test a string given to params
$this->assertInstanceOf('CI_Loader', $this->load->driver($driver, ' '));
@@ -242,8 +249,9 @@ class Loader_test extends CI_TestCase {
// Was the model class instantiated?
$this->assertTrue(class_exists($model));
$this->assertObjectHasAttribute($name, $this->ci_obj);
- $this->assertAttributeInstanceOf($base, $name, $this->ci_obj);
- $this->assertAttributeInstanceOf($model, $name, $this->ci_obj);
+ $this->assertObjectHasAttribute($name, $this->ci_obj);
+ $this->assertInstanceOf($base, $this->ci_obj->$name);
+ $this->assertInstanceOf($model, $this->ci_obj->$name);
// Test name conflict
$obj = 'conflict';
@@ -586,15 +594,18 @@ class Loader_test extends CI_TestCase {
// Verify library
$this->assertTrue(class_exists($lib_class), $lib_class.' does not exist');
- $this->assertAttributeInstanceOf($lib_class, $lib, $this->ci_obj);
+ $this->assertObjectHasAttribute($lib, $this->ci_obj);
+ $this->assertInstanceOf($lib_class, $this->ci_obj->$lib);
// Verify driver
$this->assertTrue(class_exists($drv_class), $drv_class.' does not exist');
- $this->assertAttributeInstanceOf($drv_class, $drv, $this->ci_obj);
+ $this->assertObjectHasAttribute($drv, $this->ci_obj);
+ $this->assertInstanceOf($drv_class, $this->ci_obj->$drv);
// Verify model
$this->assertTrue(class_exists($model), $model.' does not exist');
- $this->assertAttributeInstanceOf($model, $model, $this->ci_obj);
+ $this->assertObjectHasAttribute($model, $this->ci_obj);
+ $this->assertInstanceOf($model, $this->ci_obj->$model);
// Verify config calls
$this->assertEquals($cfg['config'], $this->ci_obj->config->loaded);
diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php
index 64efdf9c8..5132e5887 100644
--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -253,7 +253,10 @@ class Security_test extends CI_TestCase {
// Perform hash
$this->security->xss_hash();
- $this->assertRegExp('#^[0-9a-f]{32}$#iS', $this->security->xss_hash);
+ $assertRegExp = class_exists('PHPUnit_Runner_Version')
+ ? 'assertRegExp'
+ : 'assertMatchesRegularExpression';
+ $this->$assertRegExp('#^[0-9a-f]{32}$#iS', $this->security->xss_hash);
}
// --------------------------------------------------------------------
diff --git a/tests/codeigniter/core/compat/mbstring_test.php b/tests/codeigniter/core/compat/mbstring_test.php
index 415222446..39f48ac10 100644
--- a/tests/codeigniter/core/compat/mbstring_test.php
+++ b/tests/codeigniter/core/compat/mbstring_test.php
@@ -27,28 +27,28 @@ class mbstring_test extends CI_TestCase {
// ------------------------------------------------------------------------
/**
- * @depends test_boostrap
+ * @depends test_bootstrap
*/
public function test_mb_strpos()
{
- $this->assertEquals(ICONV_ENABLED ? 3 : 6, mb_strpos('тест', 'с'));
+ $this->assertEquals(ICONV_ENABLED ? 2 : 4, mb_strpos('тест', 'с'));
$this->assertFalse(mb_strpos('тест', 'с', 3));
- $this->assertEquals(ICONV_ENABLED ? 3 : 6, mb_strpos('тест', 'с', 1, 'UTF-8'));
+ $this->assertEquals(ICONV_ENABLED ? 2 : 4, mb_strpos('тест', 'с', 1, 'UTF-8'));
}
// ------------------------------------------------------------------------
/**
- * @depends test_boostrap
+ * @depends test_bootstrap
*/
public function test_mb_substr()
{
$this->assertEquals(ICONV_ENABLED ? 'стинг' : 'естинг', mb_substr('тестинг', 2));
$this->assertEquals(ICONV_ENABLED ? 'нг' : 'г', mb_substr('тестинг', -2));
$this->assertEquals(ICONV_ENABLED ? 'ст' : 'е', mb_substr('тестинг', 2, 2));
- $this->assertEquals(ICONV_ENABLED ? 'стинг' : 'естинг', mb_substr('тестинг', 2, 'UTF-8'));
- $this->assertEquals(ICONV_ENABLED ? 'нг' : 'г', mb_substr('тестинг', -2, 'UTF-8'));
+ $this->assertEquals(ICONV_ENABLED ? 'стинг' : 'естинг', mb_substr('тестинг', 2, NULL, 'UTF-8'));
+ $this->assertEquals(ICONV_ENABLED ? 'нг' : 'г', mb_substr('тестинг', -2, NULL, 'UTF-8'));
$this->assertEquals(ICONV_ENABLED ? 'ст' : 'е', mb_substr('тестинг', 2, 2, 'UTF-8'));
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/select_test.php b/tests/codeigniter/database/query_builder/select_test.php
index 93b5c3d46..facda791f 100644
--- a/tests/codeigniter/database/query_builder/select_test.php
+++ b/tests/codeigniter/database/query_builder/select_test.php
@@ -74,7 +74,7 @@ class Select_test extends CI_TestCase {
->row();
// Average should be 2.5
- $this->assertEquals('2.5', $job_avg->id);
+ $this->assertEquals(2.5, (float) $job_avg->id);
}
// ------------------------------------------------------------------------
diff --git a/tests/codeigniter/helpers/array_helper_test.php b/tests/codeigniter/helpers/array_helper_test.php
index b2409c330..f4e344673 100644
--- a/tests/codeigniter/helpers/array_helper_test.php
+++ b/tests/codeigniter/helpers/array_helper_test.php
@@ -38,8 +38,8 @@ class Array_helper_test extends CI_TestCase {
public function test_elements()
{
- $this->assertInternalType('array', elements('test', $this->my_array));
- $this->assertInternalType('array', elements('foo', $this->my_array));
+ $this->assertEquals('array', gettype(elements('test', $this->my_array)));
+ $this->assertEquals('array', gettype(elements('foo', $this->my_array)));
}
}
diff --git a/tests/codeigniter/helpers/file_helper_test.php b/tests/codeigniter/helpers/file_helper_test.php
index dd74ee46b..8d7f8e1eb 100644
--- a/tests/codeigniter/helpers/file_helper_test.php
+++ b/tests/codeigniter/helpers/file_helper_test.php
@@ -6,10 +6,7 @@ class File_helper_Test extends CI_TestCase {
{
$this->helper('file');
- vfsStreamWrapper::register();
- vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir'));
-
- $this->_test_dir = vfsStreamWrapper::getRoot();
+ $this->_test_dir = vfsStream::setup('');
}
// --------------------------------------------------------------------
diff --git a/tests/codeigniter/helpers/string_helper_test.php b/tests/codeigniter/helpers/string_helper_test.php
index 6de336b01..4f15909ff 100644
--- a/tests/codeigniter/helpers/string_helper_test.php
+++ b/tests/codeigniter/helpers/string_helper_test.php
@@ -99,7 +99,7 @@ class String_helper_test extends CI_TestCase {
{
$this->assertEquals(16, strlen(random_string('alnum', 16)));
$this->assertEquals(32, strlen(random_string('unique', 16)));
- $this->assertInternalType('string', random_string('numeric', 16));
+ $this->assertEquals('string', gettype(random_string('numeric', 16)));
}
// --------------------------------------------------------------------
diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php
index 36465f203..0713775da 100644
--- a/tests/codeigniter/helpers/text_helper_test.php
+++ b/tests/codeigniter/helpers/text_helper_test.php
@@ -64,6 +64,11 @@ class Text_helper_test extends CI_TestCase {
public function test_convert_accented_characters()
{
+ if (substr(PHP_VERSION, 0, 3) === '7.4')
+ {
+ return $this->markTestSkipped('For some reason all PHP 7.4 instances on GitHub Actions trigger a parse error when foreign_chars.php is loaded');
+ }
+
$this->ci_vfs_clone('application/config/foreign_chars.php');
$this->assertEquals('AAAeEEEIIOOEUUUeY', convert_accented_characters('ÀÂÄÈÊËÎÏÔŒÙÛÜŸ'));
$this->assertEquals('a e i o u n ue', convert_accented_characters('á é í ó ú ñ ü'));
diff --git a/tests/codeigniter/libraries/Driver_test.php b/tests/codeigniter/libraries/Driver_test.php
index e4401e688..ea5cfa235 100644
--- a/tests/codeigniter/libraries/Driver_test.php
+++ b/tests/codeigniter/libraries/Driver_test.php
@@ -5,6 +5,8 @@
*/
class Driver_test extends CI_TestCase {
+ private $name;
+
/**
* Set up test framework
*/
@@ -50,8 +52,8 @@ class Driver_test extends CI_TestCase {
// Was driver loaded?
$this->assertObjectHasAttribute($driver, $this->lib);
- $this->assertAttributeInstanceOf($class, $driver, $this->lib);
- $this->assertAttributeInstanceOf('CI_Driver', $driver, $this->lib);
+ $this->assertInstanceOf($class, $this->lib->$driver);
+ $this->assertInstanceOf('CI_Driver', $this->lib->$driver);
// Was decorate called?
$this->assertObjectHasAttribute($prop, $this->lib->$driver);
@@ -85,8 +87,8 @@ class Driver_test extends CI_TestCase {
// Was driver loaded?
$this->assertObjectHasAttribute($driver, $this->lib);
- $this->assertAttributeInstanceOf($class, $driver, $this->lib);
- $this->assertAttributeInstanceOf('CI_Driver', $driver, $this->lib);
+ $this->assertInstanceOf($class, $this->lib->$driver);
+ $this->assertInstanceOf('CI_Driver', $this->lib->$driver);
// Do we get an error for a non-existent driver?
$this->setExpectedException('RuntimeException', 'CI Error: Unable to load the requested driver: CI_'.
@@ -119,9 +121,9 @@ class Driver_test extends CI_TestCase {
// Was driver loaded?
$this->assertObjectHasAttribute($driver, $this->lib);
- $this->assertAttributeInstanceOf($class, $driver, $this->lib);
- $this->assertAttributeInstanceOf($baseclass, $driver, $this->lib);
- $this->assertAttributeInstanceOf('CI_Driver', $driver, $this->lib);
+ $this->assertInstanceOf($class, $this->lib->$driver);
+ $this->assertInstanceOf($baseclass, $this->lib->$driver);
+ $this->assertInstanceOf('CI_Driver', $this->lib->$driver);
// Create driver extension without base
$driver = 'baseless';
diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php
index 8e411d9fa..68bc3d804 100644
--- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -151,7 +151,7 @@ class Encryption_test extends CI_TestCase {
'hmac_key' => str_repeat("\x0", 16)
);
- $this->assertInternalType('array', $this->encryption->__get_params($params));
+ $this->assertEquals('array', gettype($this->encryption->__get_params($params)));
$params['base64'] = TRUE;
$params['hmac_digest'] = 'sha512';
@@ -217,7 +217,7 @@ class Encryption_test extends CI_TestCase {
/**
* encrypt(), decrypt test with custom parameters
*
- * @depends test___get_params
+ * @depends test__get_params
*/
public function test_encrypt_decrypt_custom()
{
diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php
index f505a43fc..6efae5d18 100644
--- a/tests/codeigniter/libraries/Table_test.php
+++ b/tests/codeigniter/libraries/Table_test.php
@@ -270,14 +270,14 @@ class Table_test extends CI_TestCase {
$table = $this->table->generate($data);
// Test the table header
- $this->assertContains('<th>Name</th>', $table);
- $this->assertContains('<th>Color</th>', $table);
- $this->assertContains('<th>Size</th>', $table);
+ $this->assertEquals(1, substr_count($table, '<th>Name</th>'));
+ $this->assertEquals(1, substr_count($table, '<th>Color</th>'));
+ $this->assertEquals(1, substr_count($table, '<th>Size</th>'));
// Test the first entry
- $this->assertContains('<td>Fred</td>', $table);
- $this->assertContains('<td>Blue</td>', $table);
- $this->assertContains('<td>Small</td>', $table);
+ $this->assertEquals(1, substr_count($table, '<td>Fred</td>'));
+ $this->assertEquals(1, substr_count($table, '<td>Blue</td>'));
+ $this->assertEquals(1, substr_count($table, '<td>Small</td>'));
}
}
diff --git a/tests/codeigniter/libraries/Useragent_test.php b/tests/codeigniter/libraries/Useragent_test.php
index c02f2bd9d..087544a1a 100644
--- a/tests/codeigniter/libraries/Useragent_test.php
+++ b/tests/codeigniter/libraries/Useragent_test.php
@@ -51,9 +51,9 @@ class UserAgent_test extends CI_TestCase {
public function test_referrer()
{
- $_SERVER['HTTP_REFERER'] = 'http://codeigniter.com/user_guide/';
+ $_SERVER['HTTP_REFERER'] = 'http://codeigniter.com/userguide3/';
$this->assertTrue($this->agent->is_referral());
- $this->assertEquals('http://codeigniter.com/user_guide/', $this->agent->referrer());
+ $this->assertEquals('http://codeigniter.com/userguide3/', $this->agent->referrer());
$this->agent->referer = NULL;
unset($_SERVER['HTTP_REFERER']);
diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php
index 8dc4682ef..de46f6df6 100644
--- a/tests/mocks/ci_testcase.php
+++ b/tests/mocks/ci_testcase.php
@@ -1,6 +1,6 @@
<?php
-class CI_TestCase extends PHPUnit_Framework_TestCase {
+class CI_TestCase extends \PHPUnit\Framework\TestCase {
public $ci_vfs_root;
public $ci_app_root;
@@ -35,7 +35,7 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
public function setUp()
{
// Setup VFS with base directories
- $this->ci_vfs_root = vfsStream::setup();
+ $this->ci_vfs_root = vfsStream::setup('');
$this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root);
$this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root);
$this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root);
@@ -381,4 +381,18 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
return parent::__call($method, $args);
}
+ public function setExpectedException($exception_class, $exception_message = '', $exception_code = null)
+ {
+ $use_expect_exception = method_exists($this, 'expectException');
+
+ if ($use_expect_exception)
+ {
+ $this->expectException($exception_class);
+ $exception_message !== '' && $this->expectExceptionMessage($exception_message);
+ }
+ else
+ {
+ parent::setExpectedException($exception_class, $exception_message, $exception_code);
+ }
+ }
}
diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite
index 574d3ae53..721fbd525 100755
--- a/tests/mocks/database/ci_test.sqlite
+++ b/tests/mocks/database/ci_test.sqlite
Binary files differ
diff --git a/tests/mocks/database/config/mysql.php b/tests/mocks/database/config/mysql.php
index a590b9f53..ca30cb9ca 100644
--- a/tests/mocks/database/config/mysql.php
+++ b/tests/mocks/database/config/mysql.php
@@ -5,9 +5,9 @@ return array(
// Typical Database configuration
'mysql' => array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'travis',
- 'password' => '',
+ 'password' => 'travis',
'database' => 'ci_test',
'dbdriver' => 'mysql'
),
@@ -15,7 +15,7 @@ return array(
// Database configuration with failover
'mysql_failover' => array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'not_travis',
'password' => 'wrong password',
'database' => 'not_ci_test',
@@ -23,9 +23,9 @@ return array(
'failover' => array(
array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'travis',
- 'password' => '',
+ 'password' => 'travis',
'database' => 'ci_test',
'dbdriver' => 'mysql',
)
diff --git a/tests/mocks/database/config/mysqli.php b/tests/mocks/database/config/mysqli.php
index 5dd08abb2..fd8fec962 100644
--- a/tests/mocks/database/config/mysqli.php
+++ b/tests/mocks/database/config/mysqli.php
@@ -5,9 +5,9 @@ return array(
// Typical Database configuration
'mysqli' => array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'travis',
- 'password' => '',
+ 'password' => 'travis',
'database' => 'ci_test',
'dbdriver' => 'mysqli'
),
@@ -15,7 +15,7 @@ return array(
// Database configuration with failover
'mysqli_failover' => array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'not_travis',
'password' => 'wrong password',
'database' => 'not_ci_test',
@@ -23,9 +23,9 @@ return array(
'failover' => array(
array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'travis',
- 'password' => '',
+ 'password' => 'travis',
'database' => 'ci_test',
'dbdriver' => 'mysqli',
)
diff --git a/tests/mocks/database/config/pdo/mysql.php b/tests/mocks/database/config/pdo/mysql.php
index 96608f787..89e9fb130 100644
--- a/tests/mocks/database/config/pdo/mysql.php
+++ b/tests/mocks/database/config/pdo/mysql.php
@@ -4,10 +4,10 @@ return array(
// Typical Database configuration
'pdo/mysql' => array(
- 'dsn' => 'mysql:host=localhost;dbname=ci_test',
- 'hostname' => 'localhost',
+ 'dsn' => 'mysql:host=127.0.0.1;dbname=ci_test',
+ 'hostname' => '127.0.0.1',
'username' => 'travis',
- 'password' => '',
+ 'password' => 'travis',
'database' => 'ci_test',
'dbdriver' => 'pdo',
'subdriver' => 'mysql'
@@ -16,7 +16,7 @@ return array(
// Database configuration with failover
'pdo/mysql_failover' => array(
'dsn' => '',
- 'hostname' => 'localhost',
+ 'hostname' => '127.0.0.1',
'username' => 'not_travis',
'password' => 'wrong password',
'database' => 'not_ci_test',
@@ -24,10 +24,10 @@ return array(
'subdriver' => 'mysql',
'failover' => array(
array(
- 'dsn' => 'mysql:host=localhost;dbname=ci_test',
- 'hostname' => 'localhost',
+ 'dsn' => 'mysql:host=127.0.0.1;dbname=ci_test',
+ 'hostname' => '127.0.0.1',
'username' => 'travis',
- 'password' => '',
+ 'password' => 'travis',
'database' => 'ci_test',
'dbdriver' => 'pdo',
'subdriver' => 'mysql'
diff --git a/tests/mocks/database/config/pdo/pgsql.php b/tests/mocks/database/config/pdo/pgsql.php
index e55e3ea77..846c70be9 100644
--- a/tests/mocks/database/config/pdo/pgsql.php
+++ b/tests/mocks/database/config/pdo/pgsql.php
@@ -7,7 +7,7 @@ return array(
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
'hostname' => 'localhost',
'username' => 'postgres',
- 'password' => '',
+ 'password' => 'postgres',
'database' => 'ci_test',
'dbdriver' => 'pdo',
'subdriver' => 'pgsql'
@@ -27,7 +27,7 @@ return array(
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
'hostname' => 'localhost',
'username' => 'postgres',
- 'password' => '',
+ 'password' => 'postgres',
'database' => 'ci_test',
'dbdriver' => 'pdo',
'subdriver' => 'pgsql'
diff --git a/tests/mocks/database/config/pgsql.php b/tests/mocks/database/config/pgsql.php
index 1444b0066..ce4583728 100644
--- a/tests/mocks/database/config/pgsql.php
+++ b/tests/mocks/database/config/pgsql.php
@@ -7,7 +7,7 @@ return array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'postgres',
- 'password' => '',
+ 'password' => 'postgres',
'database' => 'ci_test',
'dbdriver' => 'postgre'
),
@@ -25,7 +25,7 @@ return array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'postgres',
- 'password' => '',
+ 'password' => 'postgres',
'database' => 'ci_test',
'dbdriver' => 'postgre',
)
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index 888236ff3..e2b6e7d0e 100644
--- a/tests/mocks/database/schema/skeleton.php
+++ b/tests/mocks/database/schema/skeleton.php
@@ -76,7 +76,7 @@ class Mock_Database_Schema_Skeleton {
)
));
self::$forge->add_key('id', TRUE);
- self::$forge->create_table('user', TRUE);
+ self::$forge->create_table('user', TRUE) OR show_error('Unable to create the `user` table');
// Job Table
self::$forge->add_field(array(
@@ -93,7 +93,7 @@ class Mock_Database_Schema_Skeleton {
)
));
self::$forge->add_key('id', TRUE);
- self::$forge->create_table('job', TRUE);
+ self::$forge->create_table('job', TRUE) OR show_error('Unable to create the `job` table');
// Misc Table
self::$forge->add_field(array(
@@ -110,7 +110,7 @@ class Mock_Database_Schema_Skeleton {
)
));
self::$forge->add_key('id', TRUE);
- self::$forge->create_table('misc', TRUE);
+ self::$forge->create_table('misc', TRUE) OR show_error('Unable to create the `misc` table');
}
/**
@@ -143,11 +143,11 @@ class Mock_Database_Schema_Skeleton {
foreach ($data as $table => $dummy_data)
{
- self::$db->truncate($table);
+ self::$db->truncate($table) OR show_error("Unable to truncate `{$table}` table");
foreach ($dummy_data as $single_dummy_data)
{
- self::$db->insert($table, $single_dummy_data);
+ self::$db->insert($table, $single_dummy_data) OR show_error("Unable to insert data into `{$table}` table");
}
}
}
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 875198c4e..a1626ce91 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<testsuites>
<testsuite name="CodeIgniter Core Test Suite">
<directory suffix="test.php">./codeigniter/core</directory>
diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml
index 06d4a011b..15063fd5a 100644
--- a/tests/travis/mysql.phpunit.xml
+++ b/tests/travis/mysql.phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<const name="DB_DRIVER" value="mysql"/>
</php>
diff --git a/tests/travis/mysqli.phpunit.xml b/tests/travis/mysqli.phpunit.xml
index 1364f8bfa..c77aaa303 100644
--- a/tests/travis/mysqli.phpunit.xml
+++ b/tests/travis/mysqli.phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<const name="DB_DRIVER" value="mysqli"/>
</php>
diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml
index 7121edc45..1a9030ddf 100644
--- a/tests/travis/pdo/mysql.phpunit.xml
+++ b/tests/travis/pdo/mysql.phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<const name="DB_DRIVER" value="pdo/mysql"/>
</php>
diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml
index df3ff986e..22261ee7d 100644
--- a/tests/travis/pdo/pgsql.phpunit.xml
+++ b/tests/travis/pdo/pgsql.phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<const name="DB_DRIVER" value="pdo/pgsql"/>
</php>
diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml
index 7d867f6d1..4b0ca2fe7 100644
--- a/tests/travis/pdo/sqlite.phpunit.xml
+++ b/tests/travis/pdo/sqlite.phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<const name="DB_DRIVER" value="pdo/sqlite"/>
</php>
diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml
index bfddbf6b5..8d7979a0f 100644
--- a/tests/travis/pgsql.phpunit.xml
+++ b/tests/travis/pgsql.phpunit.xml
@@ -8,7 +8,8 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false">
<php>
<const name="DB_DRIVER" value="pgsql"/>
</php>
diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml
index 75c946aee..4eaafc19f 100644
--- a/tests/travis/sqlite.phpunit.xml
+++ b/tests/travis/sqlite.phpunit.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-
-<phpunit
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="../Bootstrap.php"
colors="true"
convertNoticesToExceptions="true"
@@ -8,18 +7,21 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
- stopOnSkipped="false">
- <php>
- <const name="DB_DRIVER" value="sqlite"/>
- </php>
- <testsuites>
- <testsuite name="CodeIgniter Core Test Suite">
- <directory suffix="test.php">../codeigniter</directory>
- </testsuite>
- </testsuites>
- <filter>
- <whitelist addUncoveredFilesFromWhitelist="false">
- <directory suffix=".php">../../system</directory>
- </whitelist>
- </filter>
-</phpunit> \ No newline at end of file
+ stopOnSkipped="false"
+ beStrictAboutTestsThatDoNotTestAnything="false"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
+>
+ <coverage includeUncoveredFiles="false">
+ <include>
+ <directory suffix=".php">../../system</directory>
+ </include>
+ </coverage>
+ <php>
+ <const name="DB_DRIVER" value="sqlite"/>
+ </php>
+ <testsuites>
+ <testsuite name="CodeIgniter Core Test Suite">
+ <directory suffix="test.php">../codeigniter</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 87fd6b9a8..b4278b1cd 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -37,7 +37,7 @@ Release Date: Not Released
- Removed previously deprecated *Cart Library*.
- Removed previously deprecated *Javascript Library* (it was always experimental in the first place).
- - Added UNIX socket connection support to :doc:`Session Library <libraries/sessions>` 'redis' driver.
+ - Added TLS and UNIX socket connection support to :doc:`Session Library <libraries/sessions>` 'redis' driver.
- Updated :doc:`ZIP Library <libraries/zip>` method ``read_dir()`` to include hidden (dot-prefixed) files.
- :doc:`Cache Library <libraries/caching>` changes include:
@@ -127,6 +127,7 @@ Release Date: Not Released
- :doc:`CAPTCHA Helper <helpers/captcha_helper>` changes include:
- Added 'img_alt' option with a default value of 'captcha'.
+ - Added 'img_class' option.
- Added ability to generate ``data:image/png;base64`` URIs instead of writing image files to disk.
- Updated to always create PNG images instead of JPEG.
@@ -140,6 +141,14 @@ Release Date: Not Released
- Improved logging of error conditions in :doc:`CAPTCHA Helper <helpers/captcha_helper>` function :php:func:`create_captcha()`.
- Added ``AUTO_INCREMENT`` support for Oracle 12.1+ to :doc:`Database Forge <database/forge>`.
- Added ``FULL [OUTER] JOIN`` support to :doc:`Query Builder <database/query_builder>`.
+ - Added support for detecting WebP image type to :doc:`File Uploading Library <libraries/file_uploading>`.
+ - Added method :doc:`Database Library <database/index>` method ``trans_active()`` to expose transaction state.
+ - Updated :doc:`Database Library <database/index>` 'pdo' driver to attempt to free resources in order to allow connections to be closed.
+ - Added ``SameSite=Strict`` attribute to the CSRF cookie sent by the :doc:`Security Class <libraries/security>`.
+ - Added ``$config['cookie_samesite']`` option and ``$samesite`` parameter to :doc:`Input Library <libraries/input>` method ``set_cookie()``.
+ - Added ``SameSite`` support through ``$config['sess_samesite']`` option to the :doc:`Session Library <libraries/sessions>`.
+ - Added a wrapper class around :doc:`Session <libraries/sessions>` drivers to deal with compatibility between PHP 8.1 and older versions.
+ - Updated a lot of code for PHP 8.0 and 8.1 compatibility.
Bug fixes for 3.1.12
====================
@@ -149,6 +158,11 @@ Bug fixes for 3.1.12
- Fixed a bug (#5857) - :doc:`Session <libraries/sessions>` data could be corrupted after a concurrent request write with the 'files' driver due to a filesize cache being incorrect.
- Fixed a bug (#5861) - :doc:`Cache Library <libraries/caching>` 'redis' driver would always use phpRedis 5 ``del()`` due to an incorrect version check.
- Fixed a bug (#5879) - :doc:`Profiler Library <general/profiling>` triggered an ``E_DEPRECATED`` warning on PHP 7.4+.
+- Fixed a bug (#5901) - :doc:`Database Library <database/index>` methods ``list_fields()`` and ``field_data()`` ignored the configured table schema on PostgreSQL.
+- Fixed a bug (#5906) - :doc:`Database Library <database/index>` 'postgre' driver couldn't use the failover feature without a ``$config['dsn']``.
+- Fixed a bug (#5903) - :doc:`common function <general/common_functions>` :php:func:`set_status_header()` didn't recognize 'HTTP/2.0' as a valid ``$_SERVER['SERVER_PROTOCOL']``.
+- Fixed a bug (#6013) - :doc:`Session <libraries/sessions>` flashdata didn't work on PHP 8.
+- Fixed a bug (#6006) - ``is_callable()`` change in PHP 8 broke :doc:`Migrations <libraries/migration>`, a part of :doc:`XML-RPC <libraries/xmlrpc>` and an edge case in 404 detection logic.
Version 3.1.11
==============
diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst
index ad53c2bfc..8a4f56784 100644
--- a/user_guide_src/source/database/db_driver_reference.rst
+++ b/user_guide_src/source/database/db_driver_reference.rst
@@ -156,7 +156,7 @@ This article is intended to be a reference for them.
.. php:method:: trans_status()
- :returns: TRUE if the transaction succeeded, FALSE if it failed
+ :returns: TRUE if the transaction succeeded, FALSE if it failed
:rtype: bool
Lets you retrieve the transaction status flag to
diff --git a/user_guide_src/source/installation/upgrade_150.rst b/user_guide_src/source/installation/upgrade_150.rst
index 50eb5eae5..527e4548d 100644
--- a/user_guide_src/source/installation/upgrade_150.rst
+++ b/user_guide_src/source/installation/upgrade_150.rst
@@ -49,8 +49,8 @@ Open your application/config/config.php file and ADD these new items::
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
- | https://codeigniter.com/user_guide/general/core_classes.html
- | https://codeigniter.com/user_guide/general/creating_libraries.html
+ | https://codeigniter.com/userguide3/general/core_classes.html
+ | https://codeigniter.com/userguide3/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
diff --git a/user_guide_src/source/installation/upgrade_3112.rst b/user_guide_src/source/installation/upgrade_3112.rst
index 1000010ab..93bcc43d3 100644
--- a/user_guide_src/source/installation/upgrade_3112.rst
+++ b/user_guide_src/source/installation/upgrade_3112.rst
@@ -18,3 +18,9 @@ Step 2: Replace config/user_agents.php
This config file has received some updates. Please copy it to
*application/config/user_agents.php*.
+
+Step 3: Replace config/mimes.php
+================================
+
+This config file has received some updates. Please copy it to
+*application/config/mimes.php*.
diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst
index 730b3a9b0..e0f3d8417 100644
--- a/user_guide_src/source/libraries/input.rst
+++ b/user_guide_src/source/libraries/input.rst
@@ -242,7 +242,7 @@ Class Reference
This method is identical to ``get()``, ``post()`` and ``cookie()``,
only it fetches the *php://input* stream data.
- .. php:method:: set_cookie($name = ''[, $value = ''[, $expire = 0[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = NULL[, $httponly = NULL]]]]]]])
+ .. php:method:: set_cookie($name = ''[, $value = ''[, $expire = 0[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = NULL[, $httponly = NULL[, $samesite = NULL]]]]]]]])
:param mixed $name: Cookie name or an array of parameters
:param string $value: Cookie value
@@ -252,6 +252,7 @@ Class Reference
:param string $prefix: Cookie name prefix
:param bool $secure: Whether to only transfer the cookie through HTTPS
:param bool $httponly: Whether to only make the cookie accessible for HTTP requests (no JavaScript)
+ :param string $samesite: SameSite attribute ('Lax', 'Strict', 'None')
:rtype: void
@@ -265,13 +266,14 @@ Class Reference
parameter::
$cookie = array(
- 'name' => 'The Cookie Name',
- 'value' => 'The Value',
- 'expire' => 86500,
- 'domain' => '.some-domain.com',
- 'path' => '/',
- 'prefix' => 'myprefix_',
- 'secure' => TRUE
+ 'name' => 'The Cookie Name',
+ 'value' => 'The Value',
+ 'expire' => 86500,
+ 'domain' => '.some-domain.com',
+ 'path' => '/',
+ 'prefix' => 'myprefix_',
+ 'secure' => TRUE,
+ 'samesite' => 'Strict'
);
$this->input->set_cookie($cookie);
@@ -297,13 +299,14 @@ Class Reference
The *httponly* and *secure* flags, when omitted, will default to your
``$config['cookie_httponly']`` and ``$config['cookie_secure']`` settings.
+ The *samesite* parameter can be ``'Lax'``, ``'Strict'`` or ``'None'``. If not set, the same-site cookie attribute will default to ``'Lax'``.
**Discrete Parameters**
If you prefer, you can set the cookie by passing data using individual
parameters::
- $this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);
+ $this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $samesite);
.. php:method:: ip_address()
diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst
index f2236c633..b87508aba 100644
--- a/user_guide_src/source/libraries/sessions.rst
+++ b/user_guide_src/source/libraries/sessions.rst
@@ -438,6 +438,8 @@ Preference Default Options
============================ =============== ======================================== ============================================================================================
**sess_driver** files files/database/redis/memcached/*custom* The session storage driver to use.
**sess_cookie_name** ci_session [A-Za-z\_-] characters only The name used for the session cookie.
+**sess_samesite** ci_session 'Lax', 'Strict' or 'None' SameSite attribute value for session cookies.
+ Defaults to ``session.cookie_samesite`` on PHP 7.3+ or 'Lax' if not present at all.
**sess_expiration** 7200 (2 hours) Time in seconds (integer) The number of seconds you would like the session to last.
If you would like a non-expiring session (until browser is closed) set the value to zero: 0
**sess_save_path** NULL None Specifies the storage location, depends on the driver being used.